Skip to content

Commit

Permalink
修复代理判断逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
auqhjjqdo committed Mar 16, 2023
1 parent 4607b12 commit 2f514df
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2f514df

Please sign in to comment.