MCPcopy Index your code
hub / github.com/RustPython/RustPython / proxy_bypass_registry

Function proxy_bypass_registry

Lib/urllib/request.py:2127–2145  ·  view source on GitHub ↗
(host)

Source from the content-addressed store, hash-verified

2125 return getproxies_environment() or getproxies_registry()
2126
2127 def proxy_bypass_registry(host):
2128 try:
2129 import winreg
2130 except ImportError:
2131 # Std modules, so should be around - but you never know!
2132 return False
2133 try:
2134 internetSettings = winreg.OpenKey(winreg.HKEY_CURRENT_USER,
2135 r'Software\Microsoft\Windows\CurrentVersion\Internet Settings')
2136 proxyEnable = winreg.QueryValueEx(internetSettings,
2137 'ProxyEnable')[0]
2138 proxyOverride = str(winreg.QueryValueEx(internetSettings,
2139 'ProxyOverride')[0])
2140 # ^^^^ Returned as Unicode but problems if not converted to ASCII
2141 except OSError:
2142 return False
2143 if not proxyEnable or not proxyOverride:
2144 return False
2145 return _proxy_bypass_winreg_override(host, proxyOverride)
2146
2147 def proxy_bypass(host):
2148 """Return True, if host should be bypassed.

Callers 1

proxy_bypassFunction · 0.85

Calls 2

strFunction · 0.85

Tested by

no test coverage detected