mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 10:51:14 +00:00
Safely coerce responseHeaders to int (#2697)
Co-authored-by: Enrico Minack <github@enrico.minack.dev>
This commit is contained in:
co-authored by
Enrico Minack
parent
48d2009c81
commit
1922ea6813
+5
-3
@@ -665,11 +665,13 @@ class Requester:
|
||||
|
||||
if Consts.headerRateRemaining in responseHeaders and Consts.headerRateLimit in responseHeaders:
|
||||
self.rate_limiting = (
|
||||
int(responseHeaders[Consts.headerRateRemaining]),
|
||||
int(responseHeaders[Consts.headerRateLimit]),
|
||||
# ints expected but sometimes floats returned: https://github.com/PyGithub/PyGithub/pull/2697
|
||||
int(float(responseHeaders[Consts.headerRateRemaining])),
|
||||
int(float(responseHeaders[Consts.headerRateLimit])),
|
||||
)
|
||||
if Consts.headerRateReset in responseHeaders:
|
||||
self.rate_limiting_resettime = int(responseHeaders[Consts.headerRateReset])
|
||||
# ints expected but sometimes floats returned: https://github.com/PyGithub/PyGithub/pull/2697
|
||||
self.rate_limiting_resettime = int(float(responseHeaders[Consts.headerRateReset]))
|
||||
|
||||
if Consts.headerOAuthScopes in responseHeaders:
|
||||
self.oauth_scopes = responseHeaders[Consts.headerOAuthScopes].split(", ")
|
||||
|
||||
Reference in New Issue
Block a user