Skip to content

Commit a249448

Browse files
committed
v1.8.10-beta1 fix bugs(LOW_SPEED_TIME)
1 parent 9c5403f commit a249448

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

utils/Client.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import random
22

3+
from curl_cffi import CurlOpt
34
from curl_cffi.requests import AsyncSession
45

56

@@ -15,16 +16,18 @@ def __init__(self, proxy=None, timeout=30, verify=True, impersonate='safari15_3'
1516
# self.ja3 = ""
1617
# self.akamai = ""
1718
# ja3=self.ja3, akamai=self.akamai
18-
self.session = AsyncSession(proxies=self.proxies, timeout=self.timeout, impersonate=self.impersonate, verify=self.verify)
19+
curl_options = {
20+
CurlOpt.LOW_SPEED_LIMIT: 1,
21+
CurlOpt.LOW_SPEED_TIME: 30
22+
}
23+
self.session = AsyncSession(proxies=self.proxies, timeout=self.timeout, impersonate=self.impersonate, verify=self.verify, curl_options=curl_options)
1924

2025
async def post(self, *args, **kwargs):
2126
r = await self.session.post(*args, **kwargs)
2227
return r
2328

2429
async def post_stream(self, *args, **kwargs):
25-
self.session.timeout = 600
2630
r = await self.session.post(*args, **kwargs)
27-
self.session.timeout = 30
2831
return r
2932

3033
async def get(self, *args, **kwargs):
@@ -46,9 +49,3 @@ async def close(self):
4649
del self.session
4750
except Exception:
4851
pass
49-
if hasattr(self, 'session2'):
50-
try:
51-
await self.session2.close()
52-
del self.session2
53-
except Exception:
54-
pass

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.8.9-beta4
1+
1.8.10-beta1

0 commit comments

Comments
 (0)