INNER CODE UNIT · Python
_get_proxies
CassiopeiaCode/q2api · app.py:150
def _get_proxies() -> Optional[Dict[str, str]]:
proxy = os.getenv("HTTP_PROXY", "").strip()
if proxy:
return {"http": proxy, "https": proxy}
return None
async def _init_global_client():
global GLOBAL_CLIENT
proxies = _get_proxies()
mounts = None
if proxies:
proxy_url = proxies.get("https") or proxies.get("http")
if proxy_url:
mounts = {
"https://": httpx.AsyncHTTPTransport(proxy=proxy_url),
"http://": httpx.AsyncHTTPTransport(proxy=proxy_url),
}
# Increased limits for high concurrency with streaming