From 4872ea9e6a71a69df9b67466400ddc56486acdae Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sun, 2 Jun 2024 17:38:05 +0100 Subject: [PATCH] Make GITHUB_API_TOKEN actually optional --- app/tasks/usertasks.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/tasks/usertasks.py b/app/tasks/usertasks.py index ef7e7521..79e434a7 100644 --- a/app/tasks/usertasks.py +++ b/app/tasks/usertasks.py @@ -97,11 +97,10 @@ def set_profile_picture_from_url(username: str, url: str): def update_github_user_id_raw(user: User, send_notif: bool = False): github_api_token = app.config.get("GITHUB_API_TOKEN") - if github_api_token is None or github_api_token == "": - raise TaskError("Importing requires a GitHub API token") url = f"https://api.github.com/users/{user.github_username}" - resp = requests.get(url, headers={"Authorization": "token " + github_api_token}, timeout=15) + headers = {"Authorization": "token " + github_api_token} if github_api_token else None + resp = requests.get(url, headers=headers, timeout=15) if resp.status_code == 404: print(" - not found", file=sys.stderr) if send_notif: