proxy_bypass_registry() — requests Function Reference
Architecture documentation for the proxy_bypass_registry() function in utils.py from the requests codebase.
Entity Profile
Dependency Diagram
graph TD bccd7f4a_1443_8aa4_b9e3_eb4dbeee9835["proxy_bypass_registry()"] 2c39b9da_e317_5e6c_bbac_8362bac2110c["utils.py"] bccd7f4a_1443_8aa4_b9e3_eb4dbeee9835 -->|defined in| 2c39b9da_e317_5e6c_bbac_8362bac2110c style bccd7f4a_1443_8aa4_b9e3_eb4dbeee9835 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/requests/utils.py lines 75–122
def proxy_bypass_registry(host):
try:
import winreg
except ImportError:
return False
try:
internetSettings = winreg.OpenKey(
winreg.HKEY_CURRENT_USER,
r"Software\Microsoft\Windows\CurrentVersion\Internet Settings",
)
# ProxyEnable could be REG_SZ or REG_DWORD, normalizing it
proxyEnable = int(winreg.QueryValueEx(internetSettings, "ProxyEnable")[0])
# ProxyOverride is almost always a string
proxyOverride = winreg.QueryValueEx(internetSettings, "ProxyOverride")[0]
except (OSError, ValueError):
return False
if not proxyEnable or not proxyOverride:
return False
# make a check value list from the registry entry: replace the
# '<local>' string by the localhost entry and the corresponding
# canonical entry.
proxyOverride = proxyOverride.split(";")
# filter out empty strings to avoid re.match return true in the following code.
proxyOverride = filter(None, proxyOverride)
# now check if we match one of the registry values.
for test in proxyOverride:
if test == "<local>":
if "." not in host:
return True
test = test.replace(".", r"\.") # mask dots
test = test.replace("*", r".*") # change glob sequence
test = test.replace("?", r".") # change glob char
if re.match(test, host, re.I):
return True
return False
def proxy_bypass(host): # noqa
"""Return True, if the host should be bypassed.
Checks proxy settings gathered from the environment, if specified,
or the registry.
"""
if getproxies_environment():
return proxy_bypass_environment(host)
else:
return proxy_bypass_registry(host)
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does proxy_bypass_registry() do?
proxy_bypass_registry() is a function in the requests codebase, defined in src/requests/utils.py.
Where is proxy_bypass_registry() defined?
proxy_bypass_registry() is defined in src/requests/utils.py at line 75.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free