Skip to content
Snippets Groups Projects
Commit 97091992 authored by ale's avatar ale
Browse files

call isatty() on the file handle

parent 0df31d32
No related branches found
No related tags found
No related merge requests found
import cookielib import cookielib
import getpass import getpass
import os
import urllib2 import urllib2
import urllib import urllib
import re import re
...@@ -44,7 +43,7 @@ class SSOProcessor(urllib2.BaseHandler): ...@@ -44,7 +43,7 @@ class SSOProcessor(urllib2.BaseHandler):
if self._otp_pattern.search(response_data): if self._otp_pattern.search(response_data):
# Only ask for an OTP when the standard input is a tty, # Only ask for an OTP when the standard input is a tty,
# otherwise simply don't send any OTP. # otherwise simply don't send any OTP.
if os.isatty(sys.stdin): if sys.stdin.isatty():
form_data['otp'] = raw_input('OTP for %s@%s: ' % ( form_data['otp'] = raw_input('OTP for %s@%s: ' % (
self._username, form_data['s'].rstrip('/'))) self._username, form_data['s'].rstrip('/')))
newreq = urllib2.Request(request_baseurl, newreq = urllib2.Request(request_baseurl,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment