mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-08 14:56:03 +00:00
feat: 代理设置同步到环境变量
This commit is contained in:
@@ -25,10 +25,14 @@ class ProxyManager:
|
||||
"https://": os.getenv("HTTPS_PROXY") or os.getenv("https_proxy"),
|
||||
}
|
||||
|
||||
if 'http' in self.ap.system_cfg.data['network-proxies']:
|
||||
if 'http' in self.ap.system_cfg.data['network-proxies'] and self.ap.system_cfg.data['network-proxies']['http']:
|
||||
self.forward_proxies['http://'] = self.ap.system_cfg.data['network-proxies']['http']
|
||||
if 'https' in self.ap.system_cfg.data['network-proxies']:
|
||||
if 'https' in self.ap.system_cfg.data['network-proxies'] and self.ap.system_cfg.data['network-proxies']['https']:
|
||||
self.forward_proxies['https://'] = self.ap.system_cfg.data['network-proxies']['https']
|
||||
|
||||
# 设置到环境变量
|
||||
os.environ['HTTP_PROXY'] = self.forward_proxies['http://']
|
||||
os.environ['HTTPS_PROXY'] = self.forward_proxies['https://']
|
||||
|
||||
def get_forward_proxies(self) -> dict:
|
||||
return self.forward_proxies.copy()
|
||||
|
||||
Reference in New Issue
Block a user