Skip to content

Commit

Permalink
Merge pull request #13 from RobertTownley/25-ratelimit-keyerror-fix
Browse files Browse the repository at this point in the history
While Loop Ratelimit Errors
esonderegger authored Aug 27, 2018
2 parents b91a0b9 + 63ef55e commit 38d7cc7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pyopenfec/utils.py
Original file line number Diff line number Diff line change
@@ -70,7 +70,10 @@ def _throttled_request(cls, url, params):
cls.wait_time))
time.sleep(cls.wait_time)
response = requests.get(url, params=params)
cls.ratelimit_remaining = int(response.headers['x-ratelimit-remaining'])
if 'x-ratelimit-remaining' in response.headers:
cls.ratelimit_remaining = int(response.headers['x-ratelimit-remaining'])
else:
cls.ratelimit_remaining = 0

cls.wait_time = 0.5
return response

0 comments on commit 38d7cc7

Please sign in to comment.