scrapely-python 0.1.50__py3-none-any.whl → 0.1.51__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.
scrapely/__init__.py CHANGED
@@ -325,7 +325,7 @@ if TYPE_CHECKING: # Static analysers and IDEs see the lazy names as plain impor
325
325
  )
326
326
  from .webhook import Webhook, WebhookEventType
327
327
 
328
- __version__ = '0.1.50'
328
+ __version__ = '0.1.51'
329
329
  __all__ = [
330
330
  # Core
331
331
  'Actor',
scrapely/charging.py CHANGED
@@ -2319,11 +2319,10 @@ async def _push_data_and_charge_one(
2319
2319
  accepted_for_items,
2320
2320
  push_err,
2321
2321
  )
2322
- # Only when the push certainly stored nothing (the storage API
2323
- # answered with an error, or the request was never sent). A
2324
- # timeout after sending may have stored the items.
2325
- if not _push_certainly_failed(push_err):
2326
- raise
2322
+ # Every failed push is voided, also a timeout, a reset after
2323
+ # sending or an unknown outcome (_push_certainly_failed False):
2324
+ # the rows may be in the dataset, but a user is never charged
2325
+ # for rows that may not have been stored.
2327
2326
  for i, ((name, _), op_id) in enumerate(zip(reserved_in_op, operation_ids)):
2328
2327
  kept = min(accepted_for_items, results[i].charged_count)
2329
2328
  if credit_used[i]:
@@ -2586,8 +2585,8 @@ async def _push_data_with_charges_one(
2586
2585
  await _gated_push(push_fn, kept)
2587
2586
  except Exception as push_err:
2588
2587
  logger.error('Dataset push failed after charges accepted (rows=%s): %s; voiding the charges', rows, push_err)
2589
- if _push_certainly_failed(push_err):
2590
- await undo(ops)
2588
+ # Voided also when the outcome is unknown: never charge for rows that may not be stored.
2589
+ await undo(ops)
2591
2590
  raise
2592
2591
  _log_atomic_refusal(shorts, len(rows_in), len(kept), given_back)
2593
2592
  return ChargeResult(
@@ -2651,6 +2650,7 @@ def _push_certainly_failed(err: BaseException) -> bool:
2651
2650
  resets after sending are not proof: the write may have landed,
2652
2651
  and neither is any error of a push one of whose earlier attempts may have been
2653
2652
  applied (``outcome_unknown``, set by the storage client's retries).
2653
+ Charging does not use it: a failed push is voided either way.
2654
2654
  """
2655
2655
  import httpx
2656
2656
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scrapely-python
3
- Version: 0.1.50
3
+ Version: 0.1.51
4
4
  Summary: Scrapely Python SDK - A toolkit for building Actors on the Scrapely platform
5
5
  Author-email: Scrapely <hello@scrape.ly>
6
6
  License-Expression: MIT AND Apache-2.0
@@ -1,9 +1,9 @@
1
- scrapely/__init__.py,sha256=GSpjAu-uehRXist5s_pLJPJAm_QDarBD-q5zthuMnNU,13040
1
+ scrapely/__init__.py,sha256=4pYB-aW9uINYxpZEwPeQc-a3YhfN5YxOz78rvKCiJ-4,13040
2
2
  scrapely/_browser_locations.py,sha256=8QVVnkms2bDn3_LDYgYDR59MvFx8757l_JYnZ7xb3oI,145269
3
3
  scrapely/actor.py,sha256=QUSwx_GQnA8nw5VfmStZdMWT8xyUN18GIx1CCGPtWwk,95852
4
4
  scrapely/browser_configuration.py,sha256=jAZapNSHLFW05B96df4wNBtcyiiU9DA3ml0yTL1FwfA,5770
5
5
  scrapely/cdp_retry.py,sha256=hdTJEAIKhApM7IOk1DrQEl8NoflSJSmqd4RbNJ2IsgI,8540
6
- scrapely/charging.py,sha256=LHc3JsP8FDKMKhhaVlW1WXAjO-xdEgfXx253MDsKEEU,122183
6
+ scrapely/charging.py,sha256=uKiRF6cRrJNBX5xD9-5Ovf0pgJs-XF-piLHTghrrn0Y,122277
7
7
  scrapely/charging_client.py,sha256=RitzAfgJui0dQKenWz_aFc0HeA1qKvzcDpk2bC7K8C0,4567
8
8
  scrapely/configuration.py,sha256=ONnzw4mhtrY2jVvoVUQ48dMgmMWnx3Gv7fXrT4pY9z8,16919
9
9
  scrapely/errors.py,sha256=V8JBCGSyqrbwMD9GDv6ahWhZ92n2cb8AWxkxth6mcI8,4062
@@ -69,10 +69,10 @@ scrapely/storage/_file_system/_key_value_store_client.py,sha256=1C22qY-RWlARzMyW
69
69
  scrapely/storage/_file_system/_storage_client.py,sha256=QHa3IULEb6AmgRFwpBqHD2OUTmtA_gl3lId-j6QdSFo,2027
70
70
  scrapely/storage_clients/__init__.py,sha256=q2pC-Rwe-BfHl018OyN_P0EDSx4-hNdxbk3pOCLLd4U,618
71
71
  scrapely/storages/__init__.py,sha256=kDNtd9VodjdHd4u7GzruJo0aB2HeiBN2_-HrkeqjmFg,139
72
- scrapely_python-0.1.50.dist-info/licenses/LICENSE,sha256=pQGY0XwjIYh-a2HfawxHq1en53bXkFkDj2Q70jKWHr4,1088
73
- scrapely_python-0.1.50.dist-info/licenses/LICENSE-APACHE,sha256=N8m0FzMq8i4UbTgXZvKEZJSD-27OF8pWZYS_atz4kTU,11355
74
- scrapely_python-0.1.50.dist-info/licenses/NOTICE,sha256=1ltrzKk2ez7x2BPNpXeyvOlTty5AfABYDBlwNilpORk,788
75
- scrapely_python-0.1.50.dist-info/METADATA,sha256=Sl22c28VeG86FFfi_zXlcFXso_uxdm89qg72EgUYJ1Y,4914
76
- scrapely_python-0.1.50.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
77
- scrapely_python-0.1.50.dist-info/top_level.txt,sha256=T4B9UMrs4q99QSAFyD1zdXhl40KnLhBKqrDkPhOTsmY,9
78
- scrapely_python-0.1.50.dist-info/RECORD,,
72
+ scrapely_python-0.1.51.dist-info/licenses/LICENSE,sha256=pQGY0XwjIYh-a2HfawxHq1en53bXkFkDj2Q70jKWHr4,1088
73
+ scrapely_python-0.1.51.dist-info/licenses/LICENSE-APACHE,sha256=N8m0FzMq8i4UbTgXZvKEZJSD-27OF8pWZYS_atz4kTU,11355
74
+ scrapely_python-0.1.51.dist-info/licenses/NOTICE,sha256=1ltrzKk2ez7x2BPNpXeyvOlTty5AfABYDBlwNilpORk,788
75
+ scrapely_python-0.1.51.dist-info/METADATA,sha256=6NzgNZQZoRnW4nXMX2gNejsWY-jjuy1zgbh6QtEswfA,4914
76
+ scrapely_python-0.1.51.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
77
+ scrapely_python-0.1.51.dist-info/top_level.txt,sha256=T4B9UMrs4q99QSAFyD1zdXhl40KnLhBKqrDkPhOTsmY,9
78
+ scrapely_python-0.1.51.dist-info/RECORD,,