Show More
@@ -66,13 +66,13 b' def get_auth_token():' | |||
|
66 | 66 | response = requests.post('https://api.github.com/authorizations', |
|
67 | 67 | auth=(user, pw), data=json.dumps(auth_request)) |
|
68 | 68 | if response.status_code == 401 and \ |
|
69 |
response.headers.get('X-GitHub-OTP' |
|
|
70 |
print("Your login API re |
|
|
71 |
|
|
|
69 | 'required;' in response.headers.get('X-GitHub-OTP', ''): | |
|
70 | print("Your login API requested a one time password", file=sys.stderr) | |
|
71 | otp = getpass.getpass("One Time Password: ", stream=sys.stderr) | |
|
72 | 72 | response = requests.post('https://api.github.com/authorizations', |
|
73 | 73 | auth=(user, pw), |
|
74 | 74 | data=json.dumps(auth_request), |
|
75 |
headers={'X-GitHub-OTP': |
|
|
75 | headers={'X-GitHub-OTP':otp}) | |
|
76 | 76 | response.raise_for_status() |
|
77 | 77 | token = json.loads(response.text)['token'] |
|
78 | 78 | keyring.set_password('github', fake_username, token) |
General Comments 0
You need to be logged in to leave comments.
Login now