Skip to content

Commit

Permalink
Improve rate limit detecting for GH API
Browse files Browse the repository at this point in the history
  • Loading branch information
Felixoid committed Mar 26, 2024
1 parent 38256ec commit d031473
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion did/plugins/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ def request_data(url, headers):
except requests.exceptions.JSONDecodeError as error:
log.debug(error)
raise ReportError(f"GitHub JSON failed: {response.text}.")
if data.get("message", "").startswith("API rate limit exceeded"):
if (response.status_code in (403, 409)
and data.get("message", "").startswith("API rate limit exceeded")):
raise ReportError(
"GitHub API rate limit exceeded. "
"Consider creating an access token.")
Expand Down

0 comments on commit d031473

Please sign in to comment.