def OAuthTokenFromUrl(url, scopes_param_prefix='oauth_token_scope'):
 if isinstance(url, (str, unicode)):
  url = atom.url.parse_url(url)
 if ('oauth_token' not in url.params):
  return None
 scopes = []
 if (scopes_param_prefix in url.params):
  scopes = url.params[scopes_param_prefix].split(' ')
 token_key = url.params['oauth_token']
 token = OAuthToken(key=token_key, scopes=scopes)
 return token

def OAuthTokenFromUrl ( url , scopes_param_prefix = 'oauth_token_scope' ) : if isinstance ( url , ( str , unicode ) ) : url = atom . url . parse_url ( url ) if ( 'oauth_token' not in url . params ) : return None scopes = [ ] if ( scopes_param_prefix in url . params ) : scopes = url . params [ scopes_param_prefix ] . split ( ' ' ) token_key = url . params [ 'oauth_token' ] token = OAuthToken ( key = token_key , scopes = scopes ) return token
creates an oauthtoken and sets token key and scopes from url .