From 2f514df3cadafd17dcf1d25c0718eebc69c79a62 Mon Sep 17 00:00:00 2001 From: auqhjjqdo <1054708006@qq.com> Date: Fri, 17 Mar 2023 00:52:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=A3=E7=90=86=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 18dd489..869d34d 100644 --- a/main.py +++ b/main.py @@ -20,7 +20,7 @@ class LiveRecoder: def __init__(self, config: dict, user: dict): self.interval = config['interval'] - self.proxy = config.get('proxy', request.getproxies().get('http')) + self.proxy = config.get('proxy') self.platform = user['platform'] self.id = user['id'] @@ -50,10 +50,13 @@ def get_client(self): 'headers': self.headers, 'cookies': self.cookies } - if 'socks' in self.proxy: - kwargs['transport'] = AsyncProxyTransport.from_url(self.proxy) + if self.proxy: + if 'socks' in self.proxy: + kwargs['transport'] = AsyncProxyTransport.from_url(self.proxy) + else: + kwargs['proxies'] = self.proxy else: - kwargs['proxies'] = self.proxy + self.proxy = request.getproxies().get('http') return httpx.AsyncClient(**kwargs) @staticmethod