@@ -443,6 +443,7 @@ def run_console(
443
443
def run_local_server (
444
444
self ,
445
445
host = "localhost" ,
446
+ bind_addr = None ,
446
447
port = 8080 ,
447
448
authorization_prompt_message = _DEFAULT_AUTH_PROMPT_MESSAGE ,
448
449
success_message = _DEFAULT_WEB_SUCCESS_MESSAGE ,
@@ -463,6 +464,11 @@ def run_local_server(
463
464
Args:
464
465
host (str): The hostname for the local redirect server. This will
465
466
be served over http, not https.
467
+ bind_addr (str): Optionally provide an ip address for the redirect
468
+ server to listen on when it is not the same as host
469
+ (e.g. in a container). Default value is None,
470
+ which means that the redirect server will listen
471
+ on the ip address specified in the host parameter.
466
472
port (int): The port for the local redirect server.
467
473
authorization_prompt_message (str): The message to display to tell
468
474
the user to navigate to the authorization URL.
@@ -483,7 +489,7 @@ def run_local_server(
483
489
# Fail fast if the address is occupied
484
490
wsgiref .simple_server .WSGIServer .allow_reuse_address = False
485
491
local_server = wsgiref .simple_server .make_server (
486
- host , port , wsgi_app , handler_class = _WSGIRequestHandler
492
+ bind_addr or host , port , wsgi_app , handler_class = _WSGIRequestHandler
487
493
)
488
494
489
495
redirect_uri_format = (
0 commit comments