@@ -161,15 +161,28 @@ def __init__(self, host="http://localhost",
161161 self .proxy = None
162162 """Proxy URL
163163 """
164- self .no_proxy = None
165- # Load proxy from environment variables (if set)
164+
165+ self .no_proxy = []
166+ # Load proxy from environment variables (if set)
166167 if os .getenv ("HTTPS_PROXY" ): self .proxy = os .getenv ("HTTPS_PROXY" )
167168 if os .getenv ("https_proxy" ): self .proxy = os .getenv ("https_proxy" )
168169 if os .getenv ("HTTP_PROXY" ): self .proxy = os .getenv ("HTTP_PROXY" )
169170 if os .getenv ("http_proxy" ): self .proxy = os .getenv ("http_proxy" )
170- # Load no_proxy from environment variables (if set)
171- if os .getenv ("NO_PROXY" ): self .no_proxy = os .getenv ("NO_PROXY" )
172- if os .getenv ("no_proxy" ): self .no_proxy = os .getenv ("no_proxy" )
171+ # Load and parse no_proxy from environment variables
172+ # Check for uppercase NO_PROXY first (should take precedence)
173+ no_proxy_env = None
174+ # Check if NO_PROXY exists in environment (even if empty)
175+ if "NO_PROXY" in os .environ :
176+ no_proxy_env = os .getenv ("NO_PROXY" )
177+ elif "no_proxy" in os .environ :
178+ no_proxy_env = os .getenv ("no_proxy" )
179+
180+ if no_proxy_env is not None and no_proxy_env != "" :
181+ self .no_proxy = [
182+ domain .strip ()
183+ for domain in no_proxy_env .split ("," )
184+ if domain .strip ()
185+ ]
173186 """bypass proxy for host in the no_proxy list.
174187 """
175188 self .proxy_headers = None
@@ -411,4 +424,4 @@ def get_host_from_settings(self, index, variables=None):
411424
412425 url = url .replace ("{" + variable_name + "}" , used_value )
413426
414- return url
427+ return url
0 commit comments