MCPcopy Create free account
hub / github.com/CaraJ7/MMSearch / get_proxy_settings

Function get_proxy_settings

utils/utils.py:29–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27
28### Proxy setting
29def get_proxy_settings():
30 http_proxy = os.environ.get('HTTP_PROXY') or os.environ.get('http_proxy')
31 https_proxy = os.environ.get('HTTPS_PROXY') or os.environ.get('https_proxy')
32
33 proxies = {}
34 if http_proxy:
35 proxies['http'] = http_proxy
36 if https_proxy:
37 proxies['https'] = https_proxy
38
39 # Try to obtain environ proxies
40 if not proxies:
41 try:
42 system_proxies = requests.utils.get_environ_proxies("")
43 if system_proxies:
44 proxies = system_proxies
45 except Exception as e:
46 logger.warning(f"Cannot obtain environ proxies: {e}")
47
48 return proxies
49
50PROXY = get_proxy_settings() # get proxy if exist
51

Callers 1

utils.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected