mirror of
https://github.com/minetest/contentdb.git
synced 2024-09-19 12:28:29 +02:00
Make GITHUB_API_TOKEN actually optional
This commit is contained in:
parent
bb39f268d3
commit
4872ea9e6a
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user