

def generate_auth_sub_url(next, scopes, secure=False, session=True, request_url=atom.http_core.parse_uri('https://www.google.com/accounts/AuthSubRequest'), domain='default', scopes_param_prefix='auth_sub_scopes'):
    "Constructs a URI for requesting a multiscope AuthSub token.\n\n  The generated token will contain a URL parameter to pass along the\n  requested scopes to the next URL. When the Google Accounts page\n  redirects the broswser to the 'next' URL, it appends the single use\n  AuthSub token value to the URL as a URL parameter with the key 'token'.\n  However, the information about which scopes were requested is not\n  included by Google Accounts. This method adds the scopes to the next\n  URL before making the request so that the redirect will be sent to\n  a page, and both the token value and the list of scopes for which the token\n  was requested.\n\n  Args:\n    next: atom.http_core.Uri or string The URL user will be sent to after\n          authorizing this web application to access their data.\n    scopes: list containint strings or atom.http_core.Uri objects. The URLs\n            of the services to be accessed. Could also be a single string\n            or single atom.http_core.Uri for requesting just one scope.\n    secure: boolean (optional) Determines whether or not the issued token\n            is a secure token.\n    session: boolean (optional) Determines whether or not the issued token\n             can be upgraded to a session token.\n    request_url: atom.http_core.Uri or str The beginning of the request URL.\n                 This is normally\n                 'http://www.google.com/accounts/AuthSubRequest' or\n                 '/accounts/AuthSubRequest'\n    domain: The domain which the account is part of. This is used for Google\n            Apps accounts, the default value is 'default' which means that\n            the requested account is a Google Account (@gmail.com for\n            example)\n    scopes_param_prefix: str (optional) The requested scopes are added as a\n                         URL parameter to the next URL so that the page at\n                         the 'next' URL can extract the token value and the\n                         valid scopes from the URL. The key for the URL\n                         parameter defaults to 'auth_sub_scopes'\n\n  Returns:\n    An atom.http_core.Uri which the user's browser should be directed to in\n    order to authorize this application to access their information.\n  "
    if isinstance(next, (str, unicode)):
        next = atom.http_core.Uri.parse_uri(next)
    if isinstance(scopes, (str, unicode, atom.http_core.Uri)):
        scopes = (scopes,)
    scopes_string = ' '.join([str(scope) for scope in scopes])
    next.query[scopes_param_prefix] = scopes_string
    if isinstance(request_url, (str, unicode)):
        request_url = atom.http_core.Uri.parse_uri(request_url)
    request_url.query['next'] = str(next)
    request_url.query['scope'] = scopes_string
    if session:
        request_url.query['session'] = '1'
    else:
        request_url.query['session'] = '0'
    if secure:
        request_url.query['secure'] = '1'
    else:
        request_url.query['secure'] = '0'
    request_url.query['hd'] = domain
    return request_url

dataset/ETHPy150Open acil-bwh/SlicerCIP/Scripted/attic/PicasaSnap/gdata/gauth.py generate_auth_sub_url/original