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

InstalledAppFlow run_local_server wsgi_app.last_request_uri / AttributeError: 'NoneType' object has no attribute 'replace' #109

Open
bVTiger opened this issue Mar 23, 2021 · 4 comments
Assignees
Labels
type: question Request for information or clarification. Not an issue.

Comments

@bVTiger
Copy link

bVTiger commented Mar 23, 2021

Hello.

The local server shuts down too quickly - it is not enough for authentication in browser.
It would be nice if it was possible to set a timeout during which the server does not shutdown.

Python 3.7.4

trace:

Traceback (most recent call last):
  File "...../chatter.py", line 226, in logIn
    success_message=self.cfg.google_success_message)
  File "......../lib/python3.7/site-packages/google_auth_oauthlib/flow.py", line 473, in run_local_server
    authorization_response = wsgi_app.last_request_uri.replace("http", "https")
AttributeError: 'NoneType' object has no attribute 'replace'

source:

flow = InstalledAppFlow.from_client_config(self.cfg.google_client_config,
                    scopes=['openid',
                            'https://www.googleapis.com/auth/userinfo.email',
                            'https://www.googleapis.com/auth/userinfo.profile'])
credentials = flow.run_local_server(port=0, success_message=self.cfg.google_success_message)

pip freeze:

alabaster==0.7.12
arabic-reshaper==2.0.15
astroid==2.4.2
astunparse==1.6.3
Babel==2.8.0
cachetools==4.2.1
certifi==2019.11.28
cffi==1.14.0
chardet==3.0.4
cryptography==2.8
cycler==0.10.0
decorator==4.4.2
distro==1.4.0
docutils==0.16
dukpy==0.2.2
esprima==4.0.1
et-xmlfile==1.0.1
freetype-py==2.1.0.post1
future==0.18.2
gevent==1.4.0
gitdb==4.0.2
GitPython==3.1.0
glfw==1.11.0
google-api-core==1.26.2
google-api-python-client==2.0.2
google-auth==1.24.0
google-auth-httplib2==0.1.0
google-auth-oauthlib==0.4.3
googleapis-common-protos==1.53.0
greenlet==0.4.15
gunicorn==20.0.4
html2text==2020.1.16
httplib2==0.19.0
idna==2.9
imageio==2.8.0
imageio-ffmpeg==0.4.1
imagesize==1.2.0
isort==5.6.4
javascripthon==0.10
jdcal==1.4.1
Jinja2==2.11.1
json-tricks==3.14.0
kiwisolver==1.1.0
lazy-object-proxy==1.4.3
macropy3==1.1.0b2
MarkupSafe==1.1.1
matplotlib==3.2.0
mccabe==0.6.1
moviepy==1.0.1
msgpack==1.0.0
msgpack-numpy==0.4.4.3
numexpr==2.7.1
numpy==1.18.1
oauthlib==3.1.0
opencv-python==4.2.0.32
openpyxl==3.0.3
packaging==20.4
pandas==1.0.1
pefile==2019.4.18
Pillow==7.0.0
proglog==0.1.9
protobuf==3.15.6
psutil==5.7.0
PsychoPy==2020.1.2
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.20
pydash==4.8.0
pyglet==1.5.0
Pygments==2.6.1
pylint==2.6.0
PyOpenGL==3.1.5
pyOpenSSL==19.1.0
pyosf==1.0.5
pyparallel==0.2.2
pyparsing==2.4.6
PyQt5==5.14.1
PyQt5-sip==12.7.1
pyserial==3.4
python-bidi==0.4.2
python-dateutil==2.8.1
python-gitlab==2.0.1
pytz==2019.3
PyYAML==5.3
pyzmq==19.0.0
questplus==2019.4
requests==2.23.0
requests-oauthlib==1.3.0
rsa==4.7
scipy==1.4.1
six==1.14.0
smmap==3.0.1
snowballstemmer==2.0.0
sounddevice==0.3.14
SoundFile==0.10.3.post1
Sphinx==3.1.1
sphinx-markdown-builder==0.5.4
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==1.0.3
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.4
tables==3.6.1
toml==0.10.2
tqdm==4.43.0
typed-ast==1.4.1
tzlocal==2.1
unify==0.5
untokenize==0.1.1
uritemplate==3.0.1
urllib3==1.25.8
wrapt==1.12.1
wxPython==4.0.7.post2
xarray==0.15.0
xlrd==1.2.0
xmltodict==0.12.0
yapf==0.30.0

@bVTiger bVTiger changed the title InstalledAppFlow run_local_server wsgi_app.last_request_uri / wsgi_app.last_request_uri InstalledAppFlow run_local_server wsgi_app.last_request_uri / AttributeError: 'NoneType' object has no attribute 'replace' Mar 24, 2021
@busunkim96
Copy link
Contributor

Hi @bVTiger,

When I've used run_local_server it generally doesn't time out until the user has clicked through and authenticated. How quickly is the timeout happening? run_console is another option if you're in a situation where it's difficult to open the browser for the user.

@busunkim96 busunkim96 added the type: question Request for information or clarification. Not an issue. label Mar 24, 2021
@busunkim96 busunkim96 self-assigned this Mar 24, 2021
@bVTiger
Copy link
Author

bVTiger commented Mar 24, 2021

Hi @busunkim96

When I've used run_local_server it generally doesn't time out until the user has clicked through and authenticated. How quickly is the timeout happening? run_console is another option if you're in a situation where it's difficult to open the browser for the user.

after 20..23 seconds approx.
run_console not very suitable for my task

@dpmartee
Copy link

dpmartee commented Mar 2, 2022

Same issue here:

File "..........\venv\lib\site-packages\google_auth_oauthlib\flow.py", line 504, in run_local_server authorization_response = wsgi_app.last_request_uri.replace("http", "https") AttributeError: 'NoneType' object has no attribute 'replace'

The server shut down too quickly.
I've tried to add open_browser=False to run_local_server to verify old issues and in less than 2 seconds python rise that error.

run_console is also now deprecated

@pembo13
Copy link

pembo13 commented Jun 5, 2023

I'm having basically the same issue, except run_console doesn't even exist anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

4 participants