def GetRemoteAppIdFromServer(server, path, remote_token=None):
 if (not remote_token):
  random.seed()
  remote_token = str(random.random())[2:]
 remote_token = str(remote_token)
 urlargs = {'rtok': remote_token}
 response = server.Send(path, payload=None, **urlargs)
 if (not response.startswith('{')):
  raise ConfigurationError(('Invalid response received from server: %s' % response))
 app_info = yaml.load(response)
 if ((not app_info) or ('rtok' not in app_info) or ('app_id' not in app_info)):
  raise ConfigurationError('Error parsing app_id lookup response')
 if (str(app_info['rtok']) != remote_token):
  raise ConfigurationError(('Token validation failed during app_id lookup. (sent %s, got %s)' % (repr(remote_token), repr(app_info['rtok']))))
 return app_info['app_id']

def GetRemoteAppIdFromServer ( server , path , remote_token = None ) : if ( not remote_token ) : random . seed ( ) remote_token = str ( random . random ( ) ) [ 2 : ] remote_token = str ( remote_token ) urlargs = { 'rtok' : remote_token } response = server . Send ( path , payload = None , ** urlargs ) if ( not response . startswith ( '{' ) ) : raise ConfigurationError ( ( 'Invalid response received from server: %s' % response ) ) app_info = yaml . load ( response ) if ( ( not app_info ) or ( 'rtok' not in app_info ) or ( 'app_id' not in app_info ) ) : raise ConfigurationError ( 'Error parsing app_id lookup response' ) if ( str ( app_info [ 'rtok' ] ) != remote_token ) : raise ConfigurationError ( ( 'Token validation failed during app_id lookup. (sent %s, got %s)' % ( repr ( remote_token ) , repr ( app_info [ 'rtok' ] ) ) ) ) return app_info [ 'app_id' ]
return the app id from a connection to an existing server .