MCPcopy Create free account
hub / github.com/ZyphrZero/z.ai2api_python / _get_proxy_config

Method _get_proxy_config

app/core/upstream.py:1005–1022  ·  view source on GitHub ↗

Get proxy configuration from settings

(self)

Source from the content-addressed store, hash-verified

1003 return "\n\n---\n" + "\n".join(citations)
1004
1005 def _get_proxy_config(self) -> Optional[str]:
1006 """Get proxy configuration from settings"""
1007 # In httpx 0.28.1, proxy parameter expects a single URL string
1008 # Support HTTP_PROXY, HTTPS_PROXY and SOCKS5_PROXY
1009
1010 if settings.HTTPS_PROXY:
1011 self.logger.info(f"🔄 使用HTTPS代理: {settings.HTTPS_PROXY}")
1012 return settings.HTTPS_PROXY
1013
1014 if settings.HTTP_PROXY:
1015 self.logger.info(f"🔄 使用HTTP代理: {settings.HTTP_PROXY}")
1016 return settings.HTTP_PROXY
1017
1018 if settings.SOCKS5_PROXY:
1019 self.logger.info(f"🔄 使用SOCKS5代理: {settings.SOCKS5_PROXY}")
1020 return settings.SOCKS5_PROXY
1021
1022 return None
1023
1024 def _build_timeout(self, read_timeout: float = 30.0) -> httpx.Timeout:
1025 """Create httpx timeout settings tuned for upstream chat traffic."""

Callers 5

_create_upstream_chatMethod · 0.95
upload_imageMethod · 0.95
chat_completionMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected