July 2017
Beginner to intermediate
312 pages
7h 27m
English
After you get your access code, you can request an access token. We will use a previously obtained access code and the application data: App ID and App secret.
url = 'https://api.pinterest.com/v1/oauth/token'
code = 'CODE'
app_id = 'APP_ID'
app_secret = 'APP_SECRET'
params = {
'grant_type' : 'authorization_code',
'client_id' : app_id,
'client_secret' : app_secret,
'code' : code
}
In this case, we have to make a POST request:
response = requests.post(url, params = params)
If we inspect the response.text variable, we can find our access token:
{"access_token": "xxxxxxxx", "token_type": "bearer", "scope": ["read_public", "write_public", "read_private", "write_private", "read_write_all"]} ...Read now
Unlock full access