abrasio 0.2.2__tar.gz → 0.2.3__tar.gz
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.
- {abrasio-0.2.2 → abrasio-0.2.3}/PKG-INFO +1 -1
- {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/cloud/api_client.py +25 -5
- {abrasio-0.2.2 → abrasio-0.2.3}/pyproject.toml +1 -1
- {abrasio-0.2.2 → abrasio-0.2.3}/.github/workflows/publish.yml +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/.gitignore +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/LICENSE +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/README.md +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/__init__.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/_api.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/_config.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/_exceptions.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/cloud/__init__.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/cloud/browser.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/http/__init__.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/http/client.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/human/__init__.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/human/actions.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/local/__init__.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/local/browser.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/local/stealth/__init__.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/local/stealth/scripts.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/sync_api/__init__.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/sync_api/_sync.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/utils/__init__.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/utils/certificates.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/utils/fingerprint.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/utils/geolocation.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/utils/human.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/docs/api-reference.md +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/docs/cloud-mode.md +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/docs/configuration.md +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/docs/fingerprint.md +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/docs/getting-started.md +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/docs/human-behavior.md +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/docs/index.md +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/examples/basic_cloud.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/examples/basic_local.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/examples/basic_local_sync.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/examples/certificado.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/examples/fingerprint_check.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/examples/human_behavior.py +0 -0
- {abrasio-0.2.2 → abrasio-0.2.3}/examples/tls_fingerprint.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: abrasio
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: Stealth web scraping SDK with optional cloud browser support
|
|
5
5
|
Project-URL: Homepage, https://github.com/Scrape-Technology/abrasio-sdk
|
|
6
6
|
Project-URL: Documentation, https://scrapetechnology.com/abrasio
|
|
@@ -4,6 +4,7 @@ from typing import Optional, Dict, Any, Tuple
|
|
|
4
4
|
import base64
|
|
5
5
|
import logging
|
|
6
6
|
import asyncio
|
|
7
|
+
import time
|
|
7
8
|
import uuid
|
|
8
9
|
|
|
9
10
|
import httpx
|
|
@@ -226,10 +227,27 @@ class AbrasioAPIClient:
|
|
|
226
227
|
TimeoutError: Session didn't become ready in time
|
|
227
228
|
SessionError: Session failed
|
|
228
229
|
"""
|
|
229
|
-
elapsed
|
|
230
|
+
# Bug fix: this used to track "elapsed" by counting loop iterations
|
|
231
|
+
# (`elapsed += poll_interval`) rather than real time. get_session()
|
|
232
|
+
# has its own retry-with-backoff (up to ~3 retries, tens of seconds
|
|
233
|
+
# each on 429/502/503/504), so a single slow iteration could burn far
|
|
234
|
+
# more than poll_interval seconds while only ever counting as one —
|
|
235
|
+
# letting the real wait balloon to many times timeout_seconds, or
|
|
236
|
+
# never time out at all under sustained API flakiness. Track real
|
|
237
|
+
# wall-clock time instead, and bound each get_session() call to
|
|
238
|
+
# whatever time remains so the total can't overrun the budget either.
|
|
239
|
+
deadline = time.monotonic() + timeout_seconds
|
|
240
|
+
|
|
241
|
+
while True:
|
|
242
|
+
remaining = deadline - time.monotonic()
|
|
243
|
+
if remaining <= 0:
|
|
244
|
+
break
|
|
245
|
+
|
|
246
|
+
try:
|
|
247
|
+
session = await asyncio.wait_for(self.get_session(session_id), timeout=remaining)
|
|
248
|
+
except asyncio.TimeoutError:
|
|
249
|
+
break
|
|
230
250
|
|
|
231
|
-
while elapsed < timeout_seconds:
|
|
232
|
-
session = await self.get_session(session_id)
|
|
233
251
|
status = session.get("status")
|
|
234
252
|
|
|
235
253
|
if status == "READY":
|
|
@@ -244,8 +262,10 @@ class AbrasioAPIClient:
|
|
|
244
262
|
raise SessionError("Session already finished", session_id)
|
|
245
263
|
|
|
246
264
|
logger.debug(f"Session {session_id} status: {status}, waiting...")
|
|
247
|
-
|
|
248
|
-
|
|
265
|
+
remaining = deadline - time.monotonic()
|
|
266
|
+
if remaining <= 0:
|
|
267
|
+
break
|
|
268
|
+
await asyncio.sleep(min(poll_interval, remaining))
|
|
249
269
|
|
|
250
270
|
raise TimeoutError(
|
|
251
271
|
f"Session {session_id} did not become ready within {timeout_seconds}s",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|