Skip to content

Commit d1d1d8d

Browse files
[Async] Apply #2332 to async code
1 parent a58b9b6 commit d1d1d8d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/snowflake/connector/aio/auth/_webbrowser.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,19 @@ async def prepare(
9494
socket_connection.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
9595

9696
try:
97+
hostname = os.getenv("SF_AUTH_SOCKET_ADDR", "localhost")
9798
try:
9899
socket_connection.bind(
99100
(
100-
os.getenv("SF_AUTH_SOCKET_ADDR", "localhost"),
101+
hostname,
101102
int(os.getenv("SF_AUTH_SOCKET_PORT", 0)),
102103
)
103104
)
104105
except socket.gaierror as ex:
105106
if ex.args[0] == socket.EAI_NONAME:
106107
raise OperationalError(
107-
msg="localhost is not found. Ensure /etc/hosts has "
108-
"localhost entry.",
108+
msg=f"{hostname} is not found. Ensure /etc/hosts has "
109+
f"{hostname} entry.",
109110
errno=ER_NO_HOSTNAME_FOUND,
110111
)
111112
else:

0 commit comments

Comments
 (0)