Skip to content

Commit ee38917

Browse files
committed
add bind_addr to run_local_server
1 parent 90d3d59 commit ee38917

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

google_auth_oauthlib/flow.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ def run_console(
443443
def run_local_server(
444444
self,
445445
host="localhost",
446+
bind_addr=None,
446447
port=8080,
447448
authorization_prompt_message=_DEFAULT_AUTH_PROMPT_MESSAGE,
448449
success_message=_DEFAULT_WEB_SUCCESS_MESSAGE,
@@ -463,6 +464,8 @@ def run_local_server(
463464
Args:
464465
host (str): The hostname for the local redirect server. This will
465466
be served over http, not https.
467+
bind_addr (str): The ip address for the redirect server to listen on
468+
when it is not the same as host (e.g. in a container).
466469
port (int): The port for the local redirect server.
467470
authorization_prompt_message (str): The message to display to tell
468471
the user to navigate to the authorization URL.
@@ -483,7 +486,7 @@ def run_local_server(
483486
# Fail fast if the address is occupied
484487
wsgiref.simple_server.WSGIServer.allow_reuse_address = False
485488
local_server = wsgiref.simple_server.make_server(
486-
host, port, wsgi_app, handler_class=_WSGIRequestHandler
489+
bind_addr or host, port, wsgi_app, handler_class=_WSGIRequestHandler
487490
)
488491

489492
redirect_uri_format = (

0 commit comments

Comments
 (0)