def ask_for_credentials():
 api = Mobileclient()
 logged_in = False
 attempts = 0
 while ((not logged_in) and (attempts < 3)):
  email = input(u'Email: ')
  password = getpass()
  logged_in = api.login(email, password, Mobileclient.FROM_MAC_ADDRESS)
  attempts += 1
 return api

def ask_for_credentials ( ) : api = Mobileclient ( ) logged_in = False attempts = 0 while ( ( not logged_in ) and ( attempts < 3 ) ) : email = input ( u'Email: ' ) password = getpass ( ) logged_in = api . login ( email , password , Mobileclient . FROM_MAC_ADDRESS ) attempts += 1 return api
make an instance of the api and attempts to login with it .