diff --git a/tools/gh_api.py b/tools/gh_api.py index de3fbf3..cac949c 100644 --- a/tools/gh_api.py +++ b/tools/gh_api.py @@ -49,10 +49,11 @@ def get_auth_token(): return token print("Please enter your github username and password. These are not " - "stored, only used to get an oAuth token. You can revoke this at " - "any time on Github.") - user = input("Username: ") - pw = getpass.getpass("Password: ") + "stored, only used to get an oAuth token. You can revoke this at " + "any time on Github.\n" + "Username: ", file=sys.stderr, end='') + user = input('') + pw = getpass.getpass("Password: ", stream=sys.stderr) auth_request = { "scopes": [ @@ -64,9 +65,10 @@ def get_auth_token(): } response = requests.post('https://api.github.com/authorizations', auth=(user, pw), data=json.dumps(auth_request)) - if response.status_code == 401 and response.headers.get('X-GitHub-OTP') == 'required; sms': - print("Your login API resquest a SMS one time password") - sms_pw = getpass.getpass("SMS password: ") + if response.status_code == 401 and \ + response.headers.get('X-GitHub-OTP') == 'required; sms': + print("Your login API resquest a SMS one time password", file=sys.stderr) + sms_pw = getpass.getpass("SMS password: ", stream=sys.stderr) response = requests.post('https://api.github.com/authorizations', auth=(user, pw), data=json.dumps(auth_request),