Compare commits

...

1 Commits
v0.2.0 ... main

Author SHA1 Message Date
7e94a15a05 Add mentor query 2024-08-20 15:52:03 +02:00

View File

@ -27,19 +27,11 @@ Best regards,
url = "https://infinity-users.projet-horizon.fr/index.php"
@click.group()
def main():
pass
@click.command()
@click.argument("to_bug")# help="The login of the user to bug")
def main(to_bug):
"""Bug a user on the Infinity platform.
Args:
to_bug (str): The login of the user to bug.
"""
if to_bug is None:
print("Please provide the login of the user to bug")
raise SystemExit(1)
def get_data():
with requests.session() as s:
response = s.post(url, data={"authpw": "astrorizon"})
if response.status_code != 200:
@ -86,7 +78,35 @@ def main(to_bug):
# Print the parsed data
mapped_login = {user["login"]: user for user in users_tbl}
return mapped_login
@main.command()
@click.argument("user")
def sponsor(user):
if user is None:
print("Please provide the login of the user to bug")
raise SystemExit(1)
mapped_login = get_data()
u = mapped_login[user]
print(u["mentor"])
print(mapped_login[u["mentor"]]["name"])
@main.command()
@click.argument("to_bug")# help="The login of the user to bug")
def go(to_bug):
"""Bug a user on the Infinity platform.
Args:
to_bug (str): The login of the user to bug.
"""
if to_bug is None:
print("Please provide the login of the user to bug")
raise SystemExit(1)
mapped_login = get_data()
# Get the current unix login of the user using python os
current_login = os.getlogin()
@ -114,7 +134,6 @@ def main(to_bug):
msg["Subject"] = "Your usage of Infinity nodes"
msg.attach(MIMEText(email_body, "plain"))
text = msg.as_string()
print(textwrap.dedent(f"""
Here is the draft of the email that is going to be sent: