

def generate_request_for_request_token(consumer_key, signature_type, scopes, rsa_key=None, consumer_secret=None, auth_server_url=REQUEST_TOKEN_URL, next='oob', version='1.0'):
    "Creates request to be sent to auth server to get an OAuth request token.\n\n  Args:\n    consumer_key:\n    signature_type: either RSA_SHA1 or HMAC_SHA1. The rsa_key must be\n        provided if the signature type is RSA but if the signature method\n        is HMAC, the consumer_secret must be used.\n    scopes: List of URL prefixes for the data which we want to access. For\n        example, to request access to the user's Blogger and Google Calendar\n        data, we would request\n        ['http://www.blogger.com/feeds/',\n         'https://www.google.com/calendar/feeds/',\n         'http://www.google.com/calendar/feeds/']\n    rsa_key: Only used if the signature method is RSA_SHA1.\n    consumer_secret: Only used if the signature method is HMAC_SHA1.\n    auth_server_url: The URL to which the token request should be directed.\n        Defaults to 'https://www.google.com/accounts/OAuthGetRequestToken'.\n    next: The URL of the page that the user's browser should be sent to\n        after they authorize the token. (Optional)\n    version: The OAuth version used by the requesting web application.\n        Defaults to '1.0a'\n\n  Returns:\n    An atom.http_core.HttpRequest object with the URL, Authorization header\n    and body filled in.\n  "
    request = atom.http_core.HttpRequest(auth_server_url, 'POST')
    if scopes:
        request.uri.query['scope'] = ' '.join(scopes)
    timestamp = str(int(time.time()))
    nonce = ''.join([str(random.randint(0, 9)) for i in xrange(15)])
    signature = None
    if (signature_type == HMAC_SHA1):
        signature = generate_hmac_signature(signature, consumer_key, consumer_secret, timestamp, nonce, version, next=next)
    elif (signature_type == RSA_SHA1):
        signature = generate_rsa_signature(request, consumer_key, rsa_key, timestamp, nonce, version, next=next)
    else:
        return None
    request.headers['Authorization'] = generate_auth_header(consumer_key, timestamp, nonce, signature_type, signature, version, next)
    request.headers['Content-Length'] = '0'
    return request

dataset/ETHPy150Open acil-bwh/SlicerCIP/Scripted/attic/PicasaSnap/gdata/gauth.py generate_request_for_request_token/VarMisuse@130/658 `request`->`signature`