Open hauntsaninja opened 3 days ago
Hi @hauntsaninja , can you share your code snippet to reproduce the issue? I tried the snippet below but did not see any network traffic.
from http.client import HTTPConnection
import logging
HTTPConnection.debuglevel = 1
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
import msal
One easy way to check is to use strace
(on Linux):
λ strace -e trace=connect python -c 'import msal'
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
+++ exited with 0 +++
Source is the socket.getfqdn
here (class variable assignments run at import time): https://github.com/AzureAD/microsoft-authentication-library-for-python/blob/c1ead1caece73b81f7cb168ca22f8741504ec5bd/msal/managed_identity.py#L147
The latest version of msal can open sockets at import time as part of DNS resolution This is from https://github.com/AzureAD/microsoft-authentication-library-for-python/commit/95ccef07ca9f806ab51e9a04e40826c9c8e897bb#diff-24c0727ff4626c6c535d05c13b61fa4b4a47d6fc4496ec0ceadc734191de19cbR128 cc @rayluo