#NEWLINE# def GenerateOAuthAuthorizationUrl( request_token , authorization_url = 'https://www.google.com/accounts/OAuthAuthorizeToken' , callback_url = None , extra_params = None , include_scopes_in_callback = False , scopes_param_prefix = 'oauth_token_scope' ) : #NEWLINE# #INDENT# "Generates URL at which user will login to authorize the request token.\n  \n  Args:\n    request_token: gdata.auth.OAuthToken OAuth request token.\n    authorization_url: string The beginning of the authorization URL. This is\n        normally 'https://www.google.com/accounts/OAuthAuthorizeToken' or\n        '/accounts/OAuthAuthorizeToken'\n    callback_url: string (optional) The URL user will be sent to after\n        logging in and granting access.\n    extra_params: dict (optional) Additional parameters to be sent.\n    include_scopes_in_callback: Boolean (default=False) if set to True, and\n        if 'callback_url' is present, the 'callback_url' will be modified to\n        include the scope(s) from the request token as a URL parameter. The\n        key for the 'callback' URL's scope parameter will be\n        OAUTH_SCOPE_URL_PARAM_NAME. The benefit of including the scope URL as\n        a parameter to the 'callback' URL, is that the page which receives\n        the OAuth token will be able to tell which URLs the token grants\n        access to.\n    scopes_param_prefix: string (default='oauth_token_scope') The URL\n        parameter key which maps to the list of valid scopes for the token.\n        This URL parameter will be included in the callback URL along with\n        the scopes of the token as value if include_scopes_in_callback=True.\n\n  Returns:\n    atom.url.Url OAuth authorization URL.\n  " #NEWLINE# scopes = request_token . scopes #NEWLINE# if isinstance ( scopes , list ) : #NEWLINE# #INDENT# scopes = ' ' . join ( scopes ) #NEWLINE# #UNINDENT# if ( include_scopes_in_callback and callback_url ) : #NEWLINE# #INDENT# if ( callback_url . find ( '?' ) > ( - 1 ) ) : #NEWLINE# #INDENT# callback_url += '&' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# callback_url += '?' #NEWLINE# #UNINDENT# callback_url += urllib . urlencode ( { #NEWLINE# #INDENT# scopes_param_prefix : scopes , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# oauth_token = oauth . OAuthToken ( request_token . key , request_token . secret ) #NEWLINE# oauth_request = oauth . OAuthRequest . from_token_and_callback ( token = oauth_token , callback = callback_url , http_url = authorization_url , parameters = extra_params ) #NEWLINE# return atom . url . parse_url ( oauth_request . to_url ( ) )