Skip to content

Commit

Permalink
add bind_addr parameter to LocalWebserverAuth (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
aripollak authored May 19, 2023
1 parent 77e4b65 commit a5dc1d9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pydrive2/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,11 @@ def access_token_expired(self):

@CheckAuth
def LocalWebserverAuth(
self, host_name="localhost", port_numbers=None, launch_browser=True
self,
host_name="localhost",
port_numbers=None,
launch_browser=True,
bind_addr=None,
):
"""Authenticate and authorize from user by creating local web server and
retrieving authentication code.
Expand All @@ -226,6 +230,10 @@ def LocalWebserverAuth(
:type port_numbers: list.
:param launch_browser: should browser be launched automatically
:type launch_browser: bool
:param bind_addr: optional IP address for the local web server to listen on.
If not specified, it will listen on the address specified in the
host_name parameter.
:type bind_addr: str.
:returns: str -- code returned from local web server
:raises: AuthenticationRejected, AuthenticationError
"""
Expand All @@ -241,7 +249,7 @@ def LocalWebserverAuth(
port_number = port
try:
httpd = ClientRedirectServer(
(host_name, port), ClientRedirectHandler
(bind_addr or host_name, port), ClientRedirectHandler
)
except OSError:
pass
Expand Down

0 comments on commit a5dc1d9

Please sign in to comment.