Skip to content

Commit

Permalink
Do not add Auth Headers if not provided a token
Browse files Browse the repository at this point in the history
Without this change, users get 401 bad credentials if they do not
provide a github token
  • Loading branch information
glasnt committed Dec 8, 2020
1 parent 78eb7d7 commit 2e84313
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions octohatrack/api_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 2e84313

Please sign in to comment.