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.
Files changed (42) hide show
  1. {abrasio-0.2.2 → abrasio-0.2.3}/PKG-INFO +1 -1
  2. {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/cloud/api_client.py +25 -5
  3. {abrasio-0.2.2 → abrasio-0.2.3}/pyproject.toml +1 -1
  4. {abrasio-0.2.2 → abrasio-0.2.3}/.github/workflows/publish.yml +0 -0
  5. {abrasio-0.2.2 → abrasio-0.2.3}/.gitignore +0 -0
  6. {abrasio-0.2.2 → abrasio-0.2.3}/LICENSE +0 -0
  7. {abrasio-0.2.2 → abrasio-0.2.3}/README.md +0 -0
  8. {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/__init__.py +0 -0
  9. {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/_api.py +0 -0
  10. {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/_config.py +0 -0
  11. {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/_exceptions.py +0 -0
  12. {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/cloud/__init__.py +0 -0
  13. {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/cloud/browser.py +0 -0
  14. {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/http/__init__.py +0 -0
  15. {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/http/client.py +0 -0
  16. {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/human/__init__.py +0 -0
  17. {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/human/actions.py +0 -0
  18. {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/local/__init__.py +0 -0
  19. {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/local/browser.py +0 -0
  20. {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/local/stealth/__init__.py +0 -0
  21. {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/local/stealth/scripts.py +0 -0
  22. {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/sync_api/__init__.py +0 -0
  23. {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/sync_api/_sync.py +0 -0
  24. {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/utils/__init__.py +0 -0
  25. {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/utils/certificates.py +0 -0
  26. {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/utils/fingerprint.py +0 -0
  27. {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/utils/geolocation.py +0 -0
  28. {abrasio-0.2.2 → abrasio-0.2.3}/abrasio/utils/human.py +0 -0
  29. {abrasio-0.2.2 → abrasio-0.2.3}/docs/api-reference.md +0 -0
  30. {abrasio-0.2.2 → abrasio-0.2.3}/docs/cloud-mode.md +0 -0
  31. {abrasio-0.2.2 → abrasio-0.2.3}/docs/configuration.md +0 -0
  32. {abrasio-0.2.2 → abrasio-0.2.3}/docs/fingerprint.md +0 -0
  33. {abrasio-0.2.2 → abrasio-0.2.3}/docs/getting-started.md +0 -0
  34. {abrasio-0.2.2 → abrasio-0.2.3}/docs/human-behavior.md +0 -0
  35. {abrasio-0.2.2 → abrasio-0.2.3}/docs/index.md +0 -0
  36. {abrasio-0.2.2 → abrasio-0.2.3}/examples/basic_cloud.py +0 -0
  37. {abrasio-0.2.2 → abrasio-0.2.3}/examples/basic_local.py +0 -0
  38. {abrasio-0.2.2 → abrasio-0.2.3}/examples/basic_local_sync.py +0 -0
  39. {abrasio-0.2.2 → abrasio-0.2.3}/examples/certificado.py +0 -0
  40. {abrasio-0.2.2 → abrasio-0.2.3}/examples/fingerprint_check.py +0 -0
  41. {abrasio-0.2.2 → abrasio-0.2.3}/examples/human_behavior.py +0 -0
  42. {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.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 = 0
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
- await asyncio.sleep(poll_interval)
248
- elapsed += poll_interval
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",
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "abrasio"
7
- version = "0.2.2"
7
+ version = "0.2.3"
8
8
  description = "Stealth web scraping SDK with optional cloud browser support"
9
9
  readme = "README.md"
10
10
  license = "MIT"
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