scrapely-client-python 1.0.10__tar.gz → 1.0.11__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 (71) hide show
  1. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/CHANGELOG.md +4 -0
  2. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/PKG-INFO +1 -1
  3. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/pyproject.toml +1 -1
  4. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/pyproject.toml.orig +1 -1
  5. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/http_clients/_impit.py +18 -2
  6. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/CONTRIBUTING.md +0 -0
  7. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/LICENSE +0 -0
  8. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/NOTICE +0 -0
  9. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/README.md +0 -0
  10. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/__init__.py +0 -0
  11. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_charging.py +0 -0
  12. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_client_registry.py +0 -0
  13. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_consts.py +0 -0
  14. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_docs.py +0 -0
  15. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_literals.py +0 -0
  16. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_logging.py +0 -0
  17. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_models.py +0 -0
  18. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_pagination.py +0 -0
  19. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/__init__.py +0 -0
  20. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/_resource_client.py +0 -0
  21. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/actor.py +0 -0
  22. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/actor_collection.py +0 -0
  23. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/actor_env_var.py +0 -0
  24. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/actor_env_var_collection.py +0 -0
  25. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/actor_version.py +0 -0
  26. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/actor_version_collection.py +0 -0
  27. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/automation.py +0 -0
  28. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/automation_collection.py +0 -0
  29. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/build.py +0 -0
  30. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/build_collection.py +0 -0
  31. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/dataset.py +0 -0
  32. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/dataset_collection.py +0 -0
  33. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/key_value_store.py +0 -0
  34. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/key_value_store_collection.py +0 -0
  35. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/log.py +0 -0
  36. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/request_queue.py +0 -0
  37. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/request_queue_collection.py +0 -0
  38. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/run.py +0 -0
  39. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/run_collection.py +0 -0
  40. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/schedule.py +0 -0
  41. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/schedule_collection.py +0 -0
  42. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/store_collection.py +0 -0
  43. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/task.py +0 -0
  44. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/task_collection.py +0 -0
  45. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/user.py +0 -0
  46. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/webhook.py +0 -0
  47. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/webhook_collection.py +0 -0
  48. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/webhook_dispatch.py +0 -0
  49. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_resource_clients/webhook_dispatch_collection.py +0 -0
  50. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_scrapely_client.py +0 -0
  51. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_statistics.py +0 -0
  52. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_status_message_watcher.py +0 -0
  53. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_streamed_log.py +0 -0
  54. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_typeddicts.py +0 -0
  55. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_utils/__init__.py +0 -0
  56. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_utils/crypto.py +0 -0
  57. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_utils/encoding.py +0 -0
  58. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_utils/errors.py +0 -0
  59. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_utils/http.py +0 -0
  60. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_utils/time.py +0 -0
  61. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/_utils/try_import.py +0 -0
  62. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/errors.py +0 -0
  63. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/http_clients/__init__.py +0 -0
  64. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/http_clients/_base.py +0 -0
  65. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/http_compressors/__init__.py +0 -0
  66. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/http_compressors/_base.py +0 -0
  67. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/http_compressors/_brotli.py +0 -0
  68. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/http_compressors/_gzip.py +0 -0
  69. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/http_compressors/_resolve.py +0 -0
  70. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/py.typed +0 -0
  71. {scrapely_client_python-1.0.10 → scrapely_client_python-1.0.11}/src/scrapely_client/types.py +0 -0
@@ -2,6 +2,10 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.0.11] - 2026-11-04
6
+
7
+ - The API now sends its own 502 and 504 answers as 503 with the original status in the `X-Scrapely-Status` header (so the error body reaches you through Cloudflare). A 503 with `X-Scrapely-Status: 504` is treated like a 504: a POST or PATCH without an `Idempotency-Key` is not resent after it, since it may already have been applied. A 503 with `X-Scrapely-Status: 502` is retried like a 502.
8
+
5
9
  ## [1.0.10] - 2026-11-02
6
10
 
7
11
  - Run starts (`ActorClient.start` / `call`, `TaskClient.start` / `call`), `ActorClient.build` and `DatasetClient.push_items` send an `Idempotency-Key` header, so a request resent after a 5xx or a dropped connection starts one run or build and stores the items once.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scrapely-client-python
3
- Version: 1.0.10
3
+ Version: 1.0.11
4
4
  Summary: Scrapely API client for Python
5
5
  Keywords: scrapely,api,client,automation,crawling,scraping
6
6
  Author: TeraShift GmbH (Scrape.ly)
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "scrapely-client-python"
7
- version = "1.0.10"
7
+ version = "1.0.11"
8
8
  description = "Scrapely API client for Python"
9
9
  license = "Apache-2.0"
10
10
  license-files = [
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "scrapely-client-python"
7
- version = "1.0.10"
7
+ version = "1.0.11"
8
8
  description = "Scrapely API client for Python"
9
9
  authors = [{ name = "TeraShift GmbH (Scrape.ly)" }]
10
10
  license = "Apache-2.0"
@@ -86,6 +86,22 @@ _STORAGE_COLLECTION_PATH_RE = re.compile(r'/(?:datasets|key-value-stores|request
86
86
  # so resending can't apply it twice.
87
87
  _NOT_APPLIED_STATUS_CODES = frozenset({HTTPStatus.BAD_GATEWAY, HTTPStatus.SERVICE_UNAVAILABLE})
88
88
 
89
+ # The API answers its own 502/504 as 503 with the original in this header, so the edge (Cloudflare) keeps the
90
+ # error body. Retry decisions use the original: a 504 (e.g. a Standby container timeout) may have been applied.
91
+ _ORIGINAL_STATUS_HEADER = 'x-scrapely-status'
92
+
93
+
94
+ def _effective_status(response: Any) -> int:
95
+ """The status to act on: the original 502/504 of a 503 that carries X-Scrapely-Status, else the HTTP status."""
96
+ status = response.status_code
97
+ if status != HTTPStatus.SERVICE_UNAVAILABLE:
98
+ return status
99
+ try:
100
+ original = int((response.headers or {}).get(_ORIGINAL_STATUS_HEADER) or 0)
101
+ except (TypeError, ValueError):
102
+ return status
103
+ return original if original in (HTTPStatus.BAD_GATEWAY, HTTPStatus.GATEWAY_TIMEOUT) else status
104
+
89
105
  # Keyed requests: the first request with the key is still being applied, so a resend gets its answer shortly.
90
106
  _KEY_IN_PROGRESS_ERROR_TYPE = 'idempotency-key-in-progress'
91
107
  # Keyed requests: the server can't tell whether the first request was applied, and no resend changes that.
@@ -312,7 +328,7 @@ class ImpitHttpClient(HttpClient):
312
328
  stop_retrying()
313
329
  elif (
314
330
  response.status_code != HTTPStatus.TOO_MANY_REQUESTS
315
- and response.status_code not in _NOT_APPLIED_STATUS_CODES
331
+ and _effective_status(response) not in _NOT_APPLIED_STATUS_CODES
316
332
  and _is_unsafe_to_resend(method, url, headers, params)
317
333
  ):
318
334
  logger.debug(
@@ -605,7 +621,7 @@ class ImpitHttpClientAsync(HttpClientAsync):
605
621
  stop_retrying()
606
622
  elif (
607
623
  response.status_code != HTTPStatus.TOO_MANY_REQUESTS
608
- and response.status_code not in _NOT_APPLIED_STATUS_CODES
624
+ and _effective_status(response) not in _NOT_APPLIED_STATUS_CODES
609
625
  and _is_unsafe_to_resend(method, url, headers, params)
610
626
  ):
611
627
  logger.debug(