def get_auth_code(self):
""" Get access token for connect to youtube api """
oauth_url = 'https://accounts.google.com/o/oauth2/token'
data = dict(
refresh_token=self.refresh_token,
client_id=self.client_id,
client_secret=self.client_secret,
grant_type='refresh_token',
)
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'application/json'
}
response = requests.post(oauth_url, data=data, headers=headers)
response = response.json()
return response.get('access_token')
评论列表
文章目录