python-samples: flow.run_local_server() raises AttributeError
Expected Behavior
Work fine as here: https://developers.google.com/gmail/api/quickstart/python.
Actual Behavior
After clicking “Allow” button (second time) in browser and redirection to local page, browser shows “This site can’t be reached” error. In console script, the following error occurs:
Traceback (most recent call last):
File "script.py", line 48, in <module>
main()
File "script.py", line 29, in main
creds = flow.run_local_server(port=8088)
File "/Users/stasdeep/.virtualenvs/gmail/lib/python3.6/site-packages/google_auth_oauthlib/flow.py", line 418, in run_local_server
authorization_response = wsgi_app.last_request_uri.replace(
AttributeError: 'NoneType' object has no attribute 'replace'
Steps to Reproduce the Problem
- Create a virtualenv:
mkvirtualenv -p python3.6 gmail
- Enable Gmail API
- Install requirements:
pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib
- Run the quickstart script:
python quickstart.py
Specifications
- Python 2.7/3.6 (envs created with
virtualenvwrapper
) - macOS Mojave 10.14.1
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17
I had the same issue. I ended up switching to the Chrome browser from Safari and it worked, weird but it worked for me.
I had a similar issue the first time I ran the python quickstart.py command, but tried a second time (without install anything else) and it ran fine.
Had this problem as well in Safari; but it worked when I put the authorization url into FireFox.