(consumer, request_token, oauth_verifier,
                   google_accounts_url_generator)
return OAuthEntity(response_params['oauth_token'],
                     response_params['oauth_token_secret'])
Obtains an OAuth access token from Google Accounts.

  Args:
    consumer: An OAuth entity representing the OAuth consumer.
    request_token: An OAuthEntity representing the request token (e.g. as
      returned by GenerateRequestToken.
    oauth_verifier: The verification string displayed to the user after
      completing Google Accounts authorization.
    google_accounts_url_generator: function that creates a Google Accounts URL
      for the given URL fragment.

  Returns:
    An OAuthEntity representing the OAuth access token.
Obtains an OAuth access token from Google Accounts.
Obtains an OAuth access token from Google Accounts .
def GetAccessToken(consumer, request_token, oauth_verifier,
                   google_accounts_url_generator):
  """Obtains an OAuth access token from Google Accounts.

  Args:
    consumer: An OAuth entity representing the OAuth consumer.
    request_token: An OAuthEntity representing the request token (e.g. as
      returned by GenerateRequestToken.
    oauth_verifier: The verification string displayed to the user after
      completing Google Accounts authorization.
    google_accounts_url_generator: function that creates a Google Accounts URL
      for the given URL fragment.

  Returns:
    An OAuthEntity representing the OAuth access token.
  """
  params = {}
  FillInCommonOauthParams(params, consumer)
  params['oauth_token'] = request_token.key
  params['oauth_verifier'] = oauth_verifier
  request_url = google_accounts_url_generator.GetAccessTokenUrl()
  base_string = GenerateSignatureBaseString('GET', request_url, params)
  signature = GenerateOauthSignature(base_string, consumer.secret,
                                     request_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 ('oauth_token', 'oauth_token_secret'):
    print '%s: %s' % (param, response_params[param])
  return OAuthEntity(response_params['oauth_token'],
                     response_params['oauth_token_secret'])
def GetAccessToken ( consumer , request_token , oauth_verifier , google_accounts_url_generator ) : params = { } FillInCommonOauthParams ( params , consumer ) params [ 'oauth_token' ] = request_token . key params [ 'oauth_verifier' ] = oauth_verifier request_url = google_accounts_url_generator . GetAccessTokenUrl ( ) base_string = GenerateSignatureBaseString ( 'GET' , request_url , params ) signature = GenerateOauthSignature ( base_string , consumer . secret , request_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 ( 'oauth_token' , 'oauth_token_secret' ) : print '%s: %s' % ( param , response_params [ param ] ) return OAuthEntity ( response_params [ 'oauth_token' ] , response_params [ 'oauth_token_secret' ] )