(consumer, scope, nonce, timestamp,
                         google_accounts_url_generator)
return token
Generates an OAuth request token by talking to Google Accounts.

  Args:
    consumer: An OAuthEntity representing the OAuth consumer.
    scope: Scope for the OAuth access token.
    nonce: The nonce to use in the signature. If None is passed, a random nonce
      will be generated.
    timestamp: Timestamp to use in the signature. If None is passed, the current
      time will be used.
    google_accounts_url_generator: function that creates a Google Accounts URL
      for the given URL fragment.

  Returns:
    An OAuthEntity representing the request token.
Generates an OAuth request token by talking to Google Accounts.
Generates an OAuth request token by talking to Google Accounts .
def GenerateRequestToken(consumer, scope, nonce, timestamp,
                         google_accounts_url_generator):
  """Generates an OAuth request token by talking to Google Accounts.

  Args:
    consumer: An OAuthEntity representing the OAuth consumer.
    scope: Scope for the OAuth access token.
    nonce: The nonce to use in the signature. If None is passed, a random nonce
      will be generated.
    timestamp: Timestamp to use in the signature. If None is passed, the current
      time will be used.
    google_accounts_url_generator: function that creates a Google Accounts URL
      for the given URL fragment.

  Returns:
    An OAuthEntity representing the request token.
  """
  params = {}
  FillInCommonOauthParams(params, consumer, nonce, timestamp)
  params['oauth_callback'] = 'oob'
  params['scope'] = scope
  request_url = google_accounts_url_generator.GetRequestTokenUrl()
  token = OAuthEntity(None, '')
  base_string = GenerateSignatureBaseString('GET', request_url, params)
  signature = GenerateOauthSignature(base_string, consumer.secret,
                                     token.secret)
  params['oauth_signature'] = signature

  url = '%s?%s' % (request_url, FormatUrlParams(params))
  response = urllib.urlopen(url).read()
  response_params = ParseUrlParamString(response)
  for param in response_params.items():
    print '%s: %s' % param
  token = OAuthEntity(response_params['oauth_token'],
                      response_params['oauth_token_secret'])
  print ('To authorize token, visit this url and follow the directions '
         'to generate a verification code:')
  print '  %s?oauth_token=%s' % (
      google_accounts_url_generator.GetAuthorizeTokenUrl(),
      UrlEscape(response_params['oauth_token']))
  return token
def GenerateRequestToken ( consumer , scope , nonce , timestamp , google_accounts_url_generator ) : params = { } FillInCommonOauthParams ( params , consumer , nonce , timestamp ) params [ 'oauth_callback' ] = 'oob' params [ 'scope' ] = scope request_url = google_accounts_url_generator . GetRequestTokenUrl ( ) token = OAuthEntity ( None , '' ) base_string = GenerateSignatureBaseString ( 'GET' , request_url , params ) signature = GenerateOauthSignature ( base_string , consumer . secret , token . secret ) params [ 'oauth_signature' ] = signature url = '%s?%s' % ( request_url , FormatUrlParams ( params ) ) response = urllib . urlopen ( url ) . read ( ) response_params = ParseUrlParamString ( response ) for param in response_params . items ( ) : print '%s: %s' % param token = OAuthEntity ( response_params [ 'oauth_token' ] , response_params [ 'oauth_token_secret' ] ) print ( 'To authorize token, visit this url and follow the directions ' 'to generate a verification code:' ) print '  %s?oauth_token=%s' % ( google_accounts_url_generator . GetAuthorizeTokenUrl ( ) , UrlEscape ( response_params [ 'oauth_token' ] ) ) return token