def google_get_token(self, config, prefix):
        """Make request to Google API to get token."""
        params = {
            'code': self.request_args_get(
                'code',
                default=''),
            'client_id': self.google_api_client_id,
            'client_secret': self.google_api_client_secret,
            'redirect_uri': self.scheme_host_port_prefix(
                'http', config.host, config.port, prefix) + '/home',
            'grant_type': 'authorization_code',
        }
        payload = urlencode(params).encode('utf-8')
        url = self.google_oauth2_url + 'token'
        req = Request(url, payload)
        json_str = urlopen(req).read()
        return json.loads(json_str.decode('utf-8'))
def google_get_token ( self , config , prefix ) : params = { 'code' : self . request_args_get ( 'code' , default = '' ) , 'client_id' : self . google_api_client_id , 'client_secret' : self . google_api_client_secret , 'redirect_uri' : self . scheme_host_port_prefix ( 'http' , config . host , config . port , prefix ) + '/home' , 'grant_type' : 'authorization_code' , } payload = urlencode ( params ) . encode ( 'utf-8' ) url = self . google_oauth2_url + 'token' req = Request ( url , payload ) json_str = urlopen ( req ) . read ( ) return json . loads ( json_str . decode ( 'utf-8' ) )
Make request to Google API to get token.