From 2e843133d72eb652b291fb6504e752083948369d Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 8 Dec 2020 17:13:39 +1100 Subject: [PATCH] Do not add Auth Headers if not provided a token Without this change, users get 401 bad credentials if they do not provide a github token --- octohatrack/api_helpers.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/octohatrack/api_helpers.py b/octohatrack/api_helpers.py index 192c37f..5822ec6 100644 --- a/octohatrack/api_helpers.py +++ b/octohatrack/api_helpers.py @@ -11,9 +11,12 @@ API = "https://api.github.com/" USER_LOGIN = "user--login" -GITHUB_TOKEN = os.environ.get("GITHUB_TOKEN") +GITHUB_TOKEN = os.environ.get("GITHUB_TOKEN", None) -HEADERS = {"Authorization": "token %s" % GITHUB_TOKEN} +if GITHUB_TOKEN: + HEADERS = {"Authorization": "token %s" % GITHUB_TOKEN} +else: + HEADERS = {} if "--no-cache" not in sys.argv: requests_cache.install_cache(