Skip to content

Commit 8d53bc3

Browse files
authored
fix: Add timeout to run_local_server when waiting for response (#245)
* fix:Add timeout to run_local_server when waiting for response
1 parent 8c29d2e commit 8d53bc3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

google_auth_oauthlib/flow.py

+6
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ def run_local_server(
449449
success_message=_DEFAULT_WEB_SUCCESS_MESSAGE,
450450
open_browser=True,
451451
redirect_uri_trailing_slash=True,
452+
timeout_seconds=None,
452453
**kwargs
453454
):
454455
"""Run the flow using the server strategy.
@@ -478,6 +479,10 @@ def run_local_server(
478479
in the user's browser.
479480
redirect_uri_trailing_slash (bool): whether or not to add trailing
480481
slash when constructing the redirect_uri. Default value is True.
482+
timeout_seconds (int): It will raise an error after the timeout timing
483+
if there are no credentials response. The value is in seconds.
484+
When set to None there is no timeout.
485+
Default value is None.
481486
kwargs: Additional keyword arguments passed through to
482487
:meth:`authorization_url`.
483488
@@ -503,6 +508,7 @@ def run_local_server(
503508

504509
print(authorization_prompt_message.format(url=auth_url))
505510

511+
local_server.timeout = timeout_seconds
506512
local_server.handle_request()
507513

508514
# Note: using https here because oauthlib is very picky that

0 commit comments

Comments
 (0)