mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 10:51:14 +00:00
Correct header check for 2FA required (#1274)
Currently, we were checking for an uppercase header if GitHub was refusing our authentication because we didn't provide a token. Requests returns headers with all lowercase. Fix the const, and add a test for good measure. Fixes #1273
This commit is contained in:
+1
-1
@@ -296,7 +296,7 @@ class Requester:
|
||||
if status == 401 and output.get("message") == "Bad credentials":
|
||||
cls = GithubException.BadCredentialsException
|
||||
elif status == 401 and Consts.headerOTP in headers and re.match(r'.*required.*', headers[Consts.headerOTP]):
|
||||
cls = GithubException.TwoFactorException # pragma no cover (Should be covered)
|
||||
cls = GithubException.TwoFactorException
|
||||
elif status == 403 and output.get("message").startswith("Missing or invalid User Agent string"):
|
||||
cls = GithubException.BadUserAgentException
|
||||
elif status == 403 and (
|
||||
|
||||
Reference in New Issue
Block a user