def get_oauth_pin(oauth_url, open_browser=True):
 print(('Opening: %s\n' % oauth_url))
 if open_browser:
  print('\nIn the web browser window that opens please choose to Allow\naccess. Copy the PIN number that appears on the next page and paste or\ntype it here:\n    ')
  try:
   r = webbrowser.open(oauth_url)
   time.sleep(2)
   if (not r):
    raise Exception()
  except:
   print(("\nUh, I couldn't open a browser on your computer. Please go here to get\nyour PIN:\n\n" + oauth_url))
 else:
  print(('\nPlease go to the following URL, authorize the app, and copy the PIN:\n\n' + oauth_url))
 return _input('Please enter the PIN: ').strip()

def get_oauth_pin ( oauth_url , open_browser = True ) : print ( ( 'Opening: %s\n' % oauth_url ) ) if open_browser : print ( '\nIn the web browser window that opens please choose to Allow\naccess. Copy the PIN number that appears on the next page and paste or\ntype it here:\n    ' ) try : r = webbrowser . open ( oauth_url ) time . sleep ( 2 ) if ( not r ) : raise Exception ( ) except : print ( ( "\nUh, I couldn't open a browser on your computer. Please go here to get\nyour PIN:\n\n" + oauth_url ) ) else : print ( ( '\nPlease go to the following URL, authorize the app, and copy the PIN:\n\n' + oauth_url ) ) return _input ( 'Please enter the PIN: ' ) . strip ( )
prompt the user for the oauth pin .