Skip to content

Commit

Permalink
Hotfix: exception raised if the X-RateLimit-Remaining header is not i…
Browse files Browse the repository at this point in the history
…ncluded, even if the API call works fine
  • Loading branch information
martin-village committed Sep 28, 2024
1 parent a8be88e commit 0103a08
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tap_github/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,15 @@ def rate_throttling(response):
#returns True if tap sleeps
return True
return False

# There is not necessarily a need to provide a custom github domain - but it looks like X-RateLimit-Remaining may
# not be included in this case, even if the API calls work fine
if response.status_code == 200:
return False
if response.status_code == 429:
LOGGER.info("API rate limit exceeded. Tap will retry the data collection after %s seconds.", seconds_to_sleep)
# Arbitrary 10 second wait
time.sleep(10)

# Raise an exception if `X-RateLimit-Remaining` is not found in the header.
# API does include this key header if provided base URL is not a valid github custom domain.
Expand Down

0 comments on commit 0103a08

Please sign in to comment.