sybrenstuvel / flickrapi

Python Flickr API implementation
https://stuvel.eu/flickrapi
Other
155 stars 33 forks source link

Verifier must be unicode text type error during authorization #138

Open shacker opened 2 years ago

shacker commented 2 years ago

Using FlickrAPI 2.4 and Python 3.7.8.

No problem doing read-only calls, but now I need to make a write call. I'm trying to get oauth verification working, with or without the builtin web server, but am a bit confused by the docs, which say "It is only available on the machine the application is running on, and listens on a random port." Do I need to run this server in a separate terminal? What is the startup command for it? Or does it run automagically?

Alternatively, we can use the oob approach. But when I implement the sample code in the docs:

if not flickr.token_valid(perms="write"):
    flickr.get_request_token(oauth_callback="oob")
    authorize_url = flickr.auth_url(perms="write")
    webbrowser.open_new_tab(authorize_url)
    verifier = input("Verifier code: ")
    flickr.get_access_token(verifier)

I get a browser window, click OK, then it crashes on:

    assert isinstance(new_verifier, six.text_type), 'verifier must be unicode text type'
AssertionError: verifier must be unicode text type

I did not see or get prompted to enter a code. Other github issues here point to py2 problems but I'm using python 3.78.

This is a CLI script. Happy to use either method, but oob seems most straightforward. Any idea why this might not be working?

shacker commented 2 years ago

I should add that after authorizing at Flickr, I'm redirected to

https://localhost:16177/?oauth_token=

and get a "no server running" error, which implies that I need to run a local server... but how?