esuls 0.1.6__py3-none-any.whl → 0.1.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- esuls/request_cli.py +20 -6
- {esuls-0.1.6.dist-info → esuls-0.1.8.dist-info}/METADATA +1 -1
- esuls-0.1.8.dist-info/RECORD +10 -0
- esuls-0.1.6.dist-info/RECORD +0 -10
- {esuls-0.1.6.dist-info → esuls-0.1.8.dist-info}/WHEEL +0 -0
- {esuls-0.1.6.dist-info → esuls-0.1.8.dist-info}/licenses/LICENSE +0 -0
- {esuls-0.1.6.dist-info → esuls-0.1.8.dist-info}/top_level.txt +0 -0
esuls/request_cli.py
CHANGED
|
@@ -178,7 +178,7 @@ class AsyncRequest(AsyncContextManager['AsyncRequest']):
|
|
|
178
178
|
if response.status_code not in range(200, 300):
|
|
179
179
|
logger.warning(
|
|
180
180
|
f"Request: {response.status_code}\n"
|
|
181
|
-
f"Attempt {attempt}/{max_attempt}\n"
|
|
181
|
+
f"Attempt {attempt + 1}/{max_attempt}\n"
|
|
182
182
|
f"Url: {url}\n"
|
|
183
183
|
f"Params: {params}\n"
|
|
184
184
|
f"Response: {response.text[:1000]}\n"
|
|
@@ -194,7 +194,13 @@ class AsyncRequest(AsyncContextManager['AsyncRequest']):
|
|
|
194
194
|
if attempt + 1 == max_attempt:
|
|
195
195
|
return response if force_response else None
|
|
196
196
|
|
|
197
|
-
|
|
197
|
+
# Exponential backoff for 429 (rate limit)
|
|
198
|
+
if response.status_code == 429:
|
|
199
|
+
backoff = min(120, exception_sleep * (2 ** attempt))
|
|
200
|
+
logger.info(f"Rate limited (429), backing off for {backoff:.1f}s")
|
|
201
|
+
await asyncio.sleep(backoff)
|
|
202
|
+
else:
|
|
203
|
+
await asyncio.sleep(exception_sleep)
|
|
198
204
|
continue
|
|
199
205
|
|
|
200
206
|
# Validate JSON response
|
|
@@ -243,6 +249,7 @@ async def make_request(
|
|
|
243
249
|
params: Optional[Dict[str, Any]] = None,
|
|
244
250
|
json_data: Optional[JsonType] = None,
|
|
245
251
|
files: Optional[Dict[str, FileData]] = None,
|
|
252
|
+
data: Optional[Union[str, bytes]] = None,
|
|
246
253
|
proxy: Optional[str] = None,
|
|
247
254
|
timeout_request: int = 60,
|
|
248
255
|
max_attempt: int = 10,
|
|
@@ -283,6 +290,7 @@ async def make_request(
|
|
|
283
290
|
files=files_dict,
|
|
284
291
|
headers=request_headers,
|
|
285
292
|
timeout=timeout_request,
|
|
293
|
+
data=data,
|
|
286
294
|
)
|
|
287
295
|
|
|
288
296
|
# Create custom Response object
|
|
@@ -297,7 +305,7 @@ async def make_request(
|
|
|
297
305
|
if response.status_code not in range(200, 300):
|
|
298
306
|
logger.warning(
|
|
299
307
|
f"Request: {response.status_code}\n"
|
|
300
|
-
f"Attempt {attempt}/{max_attempt}\n"
|
|
308
|
+
f"Attempt {attempt + 1}/{max_attempt}\n"
|
|
301
309
|
f"Url: {url}\n"
|
|
302
310
|
f"Params: {params}\n"
|
|
303
311
|
f"Response: {response.text[:1000]}\n"
|
|
@@ -312,14 +320,20 @@ async def make_request(
|
|
|
312
320
|
if attempt + 1 == max_attempt:
|
|
313
321
|
return response if force_response else None
|
|
314
322
|
|
|
315
|
-
|
|
323
|
+
# Exponential backoff for 429 (rate limit)
|
|
324
|
+
if response.status_code == 429:
|
|
325
|
+
backoff = min(120, exception_sleep * (2 ** attempt))
|
|
326
|
+
logger.info(f"Rate limited (429), backing off for {backoff:.1f}s")
|
|
327
|
+
await asyncio.sleep(backoff)
|
|
328
|
+
else:
|
|
329
|
+
await asyncio.sleep(exception_sleep)
|
|
316
330
|
continue
|
|
317
331
|
|
|
318
332
|
# Validate JSON response
|
|
319
333
|
if json_response:
|
|
320
334
|
try:
|
|
321
|
-
|
|
322
|
-
if json_response_check and json_response_check not in
|
|
335
|
+
response_data = response.json()
|
|
336
|
+
if json_response_check and json_response_check not in response_data:
|
|
323
337
|
if attempt + 1 == max_attempt:
|
|
324
338
|
return None
|
|
325
339
|
await asyncio.sleep(exception_sleep)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
esuls/__init__.py,sha256=dtZtmjZZ8jNspOd17BWsE9D9ofeg3vZF0vIpSgKaZqk,529
|
|
2
|
+
esuls/db_cli.py,sha256=F1XwkuzCc69ldnDv0-X4kl4VZ9zI6oJnqmQAOe2d8jE,17931
|
|
3
|
+
esuls/download_icon.py,sha256=w-bWbyPSbWvonzq43aDDtdxIvdKSa7OSyZ7LaN0uudg,3623
|
|
4
|
+
esuls/request_cli.py,sha256=Lfxl0fwSq0npQb_qzWj7tTeqXR6tuZKpOYkjtpWjxHQ,15084
|
|
5
|
+
esuls/utils.py,sha256=R0peIanodvDrKYFWWdLZ9weIPAUZX787XIjZH40qNo0,677
|
|
6
|
+
esuls-0.1.8.dist-info/licenses/LICENSE,sha256=AY0N01ARt0kbKB7CkByYLqqNQU-yalb-rpv-eXITEWA,1066
|
|
7
|
+
esuls-0.1.8.dist-info/METADATA,sha256=FaOZdJlusRJ7eFKetj3bfWaQgHoe0rb7F7Za4RLGEHg,6994
|
|
8
|
+
esuls-0.1.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
+
esuls-0.1.8.dist-info/top_level.txt,sha256=WWBDHRhQ0DQLBZKD7Un8uFN93GvVQnP4WvJKkvbACVA,6
|
|
10
|
+
esuls-0.1.8.dist-info/RECORD,,
|
esuls-0.1.6.dist-info/RECORD
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
esuls/__init__.py,sha256=dtZtmjZZ8jNspOd17BWsE9D9ofeg3vZF0vIpSgKaZqk,529
|
|
2
|
-
esuls/db_cli.py,sha256=F1XwkuzCc69ldnDv0-X4kl4VZ9zI6oJnqmQAOe2d8jE,17931
|
|
3
|
-
esuls/download_icon.py,sha256=w-bWbyPSbWvonzq43aDDtdxIvdKSa7OSyZ7LaN0uudg,3623
|
|
4
|
-
esuls/request_cli.py,sha256=8wt2MQ4Y3J-vEVacizbbuHLSrENm41UhnnGGzi-DfDE,14277
|
|
5
|
-
esuls/utils.py,sha256=R0peIanodvDrKYFWWdLZ9weIPAUZX787XIjZH40qNo0,677
|
|
6
|
-
esuls-0.1.6.dist-info/licenses/LICENSE,sha256=AY0N01ARt0kbKB7CkByYLqqNQU-yalb-rpv-eXITEWA,1066
|
|
7
|
-
esuls-0.1.6.dist-info/METADATA,sha256=bEWkE_FStozvJNDo_IgUJaQ3GZ6mvK2UNG61HFgrfEY,6994
|
|
8
|
-
esuls-0.1.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
-
esuls-0.1.6.dist-info/top_level.txt,sha256=WWBDHRhQ0DQLBZKD7Un8uFN93GvVQnP4WvJKkvbACVA,6
|
|
10
|
-
esuls-0.1.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|