Skip to content

Commit

Permalink
Bugfix: API token
Browse files Browse the repository at this point in the history
Fixed the API token usage
  • Loading branch information
CameronRWest committed Sep 14, 2023
1 parent 8dd3b7d commit 6e49d63
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/codecarto/containers/processor/api/routers/parser_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ async def read_github_content(
headers = {
"Accept": "application/vnd.github.v3+json",
# Uncomment and set your token if you have one
"Authorization": git_api_key,
"Authorization": f"Bearer {git_api_key}",
}

response = await client.get(api_url, headers=headers, follow_redirects=False)
Expand Down Expand Up @@ -146,6 +146,17 @@ async def read_github_content(
HTTPException,
404,
)
if response.status_code == 403:
error_message = f"GitHub API returned 403: {response.text}"
# if "rate_limit" in response.text:
# error_message = f"GitHub API rate limit exceeded: {response.text}"
proc_exception(
"read_github_content",
error_message,
{"url": url, "api_url": api_url},
HTTPException,
403,
)
else:
proc_exception(
"read_github_content",
Expand Down

0 comments on commit 6e49d63

Please sign in to comment.