##// END OF EJS Templates
Update output streams so we can redirect stdout with only stats to a file....
Fernando Perez -
Show More
@@ -49,10 +49,11 b' def get_auth_token():'
49 return token
49 return token
50
50
51 print("Please enter your github username and password. These are not "
51 print("Please enter your github username and password. These are not "
52 "stored, only used to get an oAuth token. You can revoke this at "
52 "stored, only used to get an oAuth token. You can revoke this at "
53 "any time on Github.")
53 "any time on Github.\n"
54 user = input("Username: ")
54 "Username: ", file=sys.stderr, end='')
55 pw = getpass.getpass("Password: ")
55 user = input('')
56 pw = getpass.getpass("Password: ", stream=sys.stderr)
56
57
57 auth_request = {
58 auth_request = {
58 "scopes": [
59 "scopes": [
@@ -64,9 +65,10 b' def get_auth_token():'
64 }
65 }
65 response = requests.post('https://api.github.com/authorizations',
66 response = requests.post('https://api.github.com/authorizations',
66 auth=(user, pw), data=json.dumps(auth_request))
67 auth=(user, pw), data=json.dumps(auth_request))
67 if response.status_code == 401 and response.headers.get('X-GitHub-OTP') == 'required; sms':
68 if response.status_code == 401 and \
68 print("Your login API resquest a SMS one time password")
69 response.headers.get('X-GitHub-OTP') == 'required; sms':
69 sms_pw = getpass.getpass("SMS password: ")
70 print("Your login API resquest a SMS one time password", file=sys.stderr)
71 sms_pw = getpass.getpass("SMS password: ", stream=sys.stderr)
70 response = requests.post('https://api.github.com/authorizations',
72 response = requests.post('https://api.github.com/authorizations',
71 auth=(user, pw),
73 auth=(user, pw),
72 data=json.dumps(auth_request),
74 data=json.dumps(auth_request),
General Comments 0
You need to be logged in to leave comments. Login now