def _oauth_uri(name, discovery, params):
 if (name not in ['request', 'access', 'authorize']):
  raise KeyError(name)
 keys = discovery[name]['parameters'].keys()
 query = {}
 for key in keys:
  if (key in params):
   query[key] = params[key]
 return ((discovery[name]['url'] + '?') + urllib.urlencode(query))

def _oauth_uri ( name , discovery , params ) : if ( name not in [ 'request' , 'access' , 'authorize' ] ) : raise KeyError ( name ) keys = discovery [ name ] [ 'parameters' ] . keys ( ) query = { } for key in keys : if ( key in params ) : query [ key ] = params [ key ] return ( ( discovery [ name ] [ 'url' ] + '?' ) + urllib . urlencode ( query ) )
look up the oauth uri from the discovery document and add query parameters based on params .