Skip to content

Commit c3dbfda

Browse files
authored
修复self.proxy为None时产生的报错 (auqhjjqdo#50)
1 parent 0022e03 commit c3dbfda

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

live_recorder.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,17 @@ async def request(self, method, url, **kwargs):
7171
raise ConnectionError(f'{self.flag}直播检测请求错误\n{repr(error)}')
7272

7373
def get_client(self):
74+
# 检查是否有设置代理
75+
if self.proxy:
76+
transport = AsyncProxyTransport.from_url(self.proxy)
77+
else:
78+
transport = None
79+
7480
return httpx.AsyncClient(
7581
http2=True,
7682
timeout=self.interval,
7783
limits=httpx.Limits(max_keepalive_connections=100, keepalive_expiry=self.interval * 2),
78-
transport=AsyncProxyTransport.from_url(self.proxy),
84+
transport=transport,
7985
headers=self.headers,
8086
cookies=self.cookies
8187
)

0 commit comments

Comments
 (0)