pinterest / pinterest-python-sdk

An SDK that makes it quick and easy to build applications with Pinterest API.
Apache License 2.0
43 stars 28 forks source link

BUG - Fetching new access token breaks python code on 401 #114

Closed gbadnmo closed 9 months ago

gbadnmo commented 1 year ago

Describe the bug

A clear and concise description of what the bug is.

To Reproduce

Executing the following code where the refresh token is invalid or has the wrong grants

refresh_token = 'pinr.<REDACTED>'
client_id = '<REDACTED>'
client_secret = '<REDACTED>'

from pinterest.client import PinterestSDKClient
client = PinterestSDKClient.create_client_with_refresh_token(refresh_token, app_id=client_id, app_secret=client_secret)

Yields the error : AttributeError: 'HTTPResponse' object has no attribute 'body'. Did you mean: '_body'?

Expected behavior

It should throw an error the SdkException in pinterest.utils.refresh_access_token.get_new_access_token with b'{"code":283,"message":"The authorization grant is invalid"}'

Screenshots

-

Additional Details (please complete the following information):

Additional Context

Igosuki commented 9 months ago

Thanks :+1: