Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TumblpyError: Unable to decode authorized tokens #52

Open
snarfed opened this issue Jul 10, 2024 · 1 comment
Open

TumblpyError: Unable to decode authorized tokens #52

snarfed opened this issue Jul 10, 2024 · 1 comment

Comments

@snarfed
Copy link

snarfed commented Jul 10, 2024

Saw this for the first time today. No changes to tumblpy since 2017, not sure if it's stable and mature or unmaintained (or both), but filing here anyway to share details. oauth_token and oauth_verifier look ok, and oddly when the user reloaded a second later with the exact same params, it worked fine, ie didn't error. Odd.

tumblpy 1.1.4, Python 3.11, on Google App Engine.

Traceback (most recent call last):
...
  File "oauth_dropins/tumblr.py", line 117, in dispatch_request
    auth_token = tp.get_authorized_tokens(verifier)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "tumblpy/api.py", line 95, in get_authorized_tokens
    raise TumblpyError('Unable to decode authorized tokens.')
tumblpy.exceptions.TumblpyError: Unable to decode authorized tokens.
@snarfed
Copy link
Author

snarfed commented Jul 10, 2024

Oh, this is probably due to a transient error from tumblr.com itself. Looks like this happens when a response from their token URL is blank:

def get_authorized_tokens(self, oauth_verifier):
"""Returns authorized tokens after they go through the auth_url phase.
"""
response = self.client.get(self.access_token_url,
params={'oauth_verifier': oauth_verifier})
res = response.content
if isinstance( response.content, bytes ):
res = res.decode()
authorized_tokens = dict(parse_qsl(res))
if not authorized_tokens:
raise TumblpyError('Unable to decode authorized tokens.')
return authorized_tokens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant