get_environment_proxies() — anthropic-sdk-python Function Reference
Architecture documentation for the get_environment_proxies() function in _httpx.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD 7f18f9f7_1da1_e6a3_496d_32a683fb3000["get_environment_proxies()"] b2d85656_2934_236c_1afe_774e6230184c["_httpx.py"] 7f18f9f7_1da1_e6a3_496d_32a683fb3000 -->|defined in| b2d85656_2934_236c_1afe_774e6230184c e0f24174_aefd_b8d6_3e5c_b3e372191716["is_ipv4_hostname()"] 7f18f9f7_1da1_e6a3_496d_32a683fb3000 -->|calls| e0f24174_aefd_b8d6_3e5c_b3e372191716 39fc5344_fd4b_64d5_f0ed_0c67db231743["is_ipv6_hostname()"] 7f18f9f7_1da1_e6a3_496d_32a683fb3000 -->|calls| 39fc5344_fd4b_64d5_f0ed_0c67db231743 style 7f18f9f7_1da1_e6a3_496d_32a683fb3000 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/anthropic/_utils/_httpx.py lines 32–64
def get_environment_proxies() -> Mapping[str, str | None]:
"""
Gets the proxy mappings based on environment variables.
We use our own logic to parse these variables, as HTTPX
doesn’t allow full configuration of the underlying
transport when proxies are set via environment variables.
"""
proxy_info = getproxies()
mounts: dict[str, str | None] = {}
for scheme in ("http", "https", "all"):
if proxy_info.get(scheme):
hostname = proxy_info[scheme]
mounts[f"{scheme}://"] = hostname if "://" in hostname else f"http://{hostname}"
no_proxy_hosts = [host.strip() for host in proxy_info.get("no", "").split(",")]
for hostname in no_proxy_hosts:
if hostname == "*":
return {}
elif hostname:
if "://" in hostname:
mounts[hostname] = None
elif is_ipv4_hostname(hostname):
mounts[f"all://{hostname}"] = None
elif is_ipv6_hostname(hostname):
mounts[f"all://[{hostname}]"] = None
elif hostname.lower() == "localhost":
mounts[f"all://{hostname}"] = None
else:
mounts[f"all://*{hostname}"] = None
return mounts
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does get_environment_proxies() do?
get_environment_proxies() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/_utils/_httpx.py.
Where is get_environment_proxies() defined?
get_environment_proxies() is defined in src/anthropic/_utils/_httpx.py at line 32.
What does get_environment_proxies() call?
get_environment_proxies() calls 2 function(s): is_ipv4_hostname, is_ipv6_hostname.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free