Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Commit

Permalink
Fix bug in make_request method
Browse files Browse the repository at this point in the history
Values of credits updated in the make_request method were str
  • Loading branch information
kairi003 committed Feb 13, 2021
1 parent 48abc45 commit cd9a106
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions imgurpython/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,14 @@ def make_request(self, method, route, data=None, force_anon=False):
else:
response = method_to_call(url, headers=header, data=data)

self.credits = {
'UserLimit': response.headers.get('X-RateLimit-UserLimit'),
'UserRemaining': response.headers.get('X-RateLimit-UserRemaining'),
'UserReset': response.headers.get('X-RateLimit-UserReset'),
'ClientLimit': response.headers.get('X-RateLimit-ClientLimit'),
'ClientRemaining': response.headers.get('X-RateLimit-ClientRemaining')
}
if response.headers.get('X-RateLimit-UserLimit') is not None:
self.credits = {
'UserLimit': int(response.headers.get('X-RateLimit-UserLimit')),
'UserRemaining': int(response.headers.get('X-RateLimit-UserRemaining')),
'UserReset': int(response.headers.get('X-RateLimit-UserReset')),
'ClientLimit': int(response.headers.get('X-RateLimit-ClientLimit')),
'ClientRemaining': int(response.headers.get('X-RateLimit-ClientRemaining'))
}

# Rate-limit check
if response.status_code == 429:
Expand Down

0 comments on commit cd9a106

Please sign in to comment.