scrapely-python 0.1.9__tar.gz → 0.1.10__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.
- {scrapely_python-0.1.9/src/scrapely_python.egg-info → scrapely_python-0.1.10}/PKG-INFO +1 -1
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/pyproject.toml +1 -1
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/__init__.py +1 -1
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/charging.py +3 -1
- {scrapely_python-0.1.9 → scrapely_python-0.1.10/src/scrapely_python.egg-info}/PKG-INFO +1 -1
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/tests/test_charging_parity.py +38 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/tests/test_charging_pending.py +2 -1
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/LICENSE +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/LICENSE-APACHE +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/NOTICE +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/README.md +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/setup.cfg +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/_browser_locations.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/actor.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/browser_configuration.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/cdp_retry.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/charging_client.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/configuration.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/crypto/__init__.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/crypto/_secrets.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/errors.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/events/__init__.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/events/_types.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/events/event_manager.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/log.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/patch_browser_pool.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/pricing_types.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/proxy_configuration.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/py.typed +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/request_loaders/__init__.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/request_loaders/_scrapely_request_list.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/storage/__init__.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/storage/_file_system/__init__.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/storage/_file_system/_key_value_store_client.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/storage/_file_system/_storage_client.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/storage/_metadata.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/storage/api_client.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/storage/client.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/storage/patch_storage.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/storage/scrapely_dataset_client.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/storage/scrapely_kvs_client.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/storage/scrapely_rq_client.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/storage/scrapely_storage_client.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/storage/smart_scrapely_storage_client.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/storage/types.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/storage/utils.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/storage_clients/__init__.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/storages/__init__.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/types.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/webhook.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely_python.egg-info/SOURCES.txt +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely_python.egg-info/dependency_links.txt +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely_python.egg-info/requires.txt +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely_python.egg-info/top_level.txt +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/tests/test_api_client_retries.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/tests/test_apify_parity.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/tests/test_browser_configuration.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/tests/test_cdp_retry.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/tests/test_charge_retries.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/tests/test_input_proxy_aliases.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/tests/test_parity.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/tests/test_patch_browser_pool.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/tests/test_proxy_configuration.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/tests/test_run_control.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/tests/test_secrets.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/tests/test_storage.py +0 -0
- {scrapely_python-0.1.9 → scrapely_python-0.1.10}/tests/test_terminal_status_message.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "scrapely-python"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.10"
|
|
8
8
|
description = "Scrapely Python SDK - A toolkit for building Actors on the Scrapely platform"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT AND Apache-2.0"
|
|
@@ -1333,7 +1333,9 @@ async def push_data_and_charge(
|
|
|
1333
1333
|
raise
|
|
1334
1334
|
return ChargeResult(
|
|
1335
1335
|
chargeable_within_limit=charging_manager.compute_chargeable(),
|
|
1336
|
-
|
|
1336
|
+
# Rows charged, as Apify reports it for the pushed event; the
|
|
1337
|
+
# implicit default-dataset event is not counted on top.
|
|
1338
|
+
charged_count=accepted_for_items,
|
|
1337
1339
|
event_charge_limit_reached=any(
|
|
1338
1340
|
result.event_charge_limit_reached for result in results
|
|
1339
1341
|
)
|
|
@@ -338,3 +338,41 @@ async def test_local_mode_never_posts_charges_despite_client_and_run_id() -> Non
|
|
|
338
338
|
# Flushing must not attempt any remote POST either.
|
|
339
339
|
assert await mgr.flush_pending() == 0
|
|
340
340
|
assert client.post_calls == []
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
@pytest.mark.asyncio
|
|
344
|
+
async def test_push_data_with_explicit_event_reports_rows_not_rows_times_events() -> None:
|
|
345
|
+
"""charged_count is the number of rows charged, not rows x events.
|
|
346
|
+
|
|
347
|
+
With an explicit event on the default dataset the SDK also charges the
|
|
348
|
+
(unpriced) default-dataset-item event. Apify returns the explicit event's
|
|
349
|
+
count; summing both reported twice the rows pushed.
|
|
350
|
+
"""
|
|
351
|
+
from scrapely.charging import push_data_and_charge
|
|
352
|
+
|
|
353
|
+
pricing = '{"pricingModel": "PAY_PER_EVENT", "pricingPerEvent": {"actorChargeEvents": {"profile": {"eventPriceUsd": 0.001, "eventTitle": "Profile"}}}}'
|
|
354
|
+
config = _config_with({
|
|
355
|
+
'is_at_home': False,
|
|
356
|
+
'actor_pricing_info': pricing,
|
|
357
|
+
'charged_event_counts': '{}',
|
|
358
|
+
'max_total_charge_usd': '10',
|
|
359
|
+
})
|
|
360
|
+
mgr = ChargingManager(config, None)
|
|
361
|
+
await mgr.init()
|
|
362
|
+
|
|
363
|
+
pushed: List[Any] = []
|
|
364
|
+
|
|
365
|
+
async def push_fn(items: List[Any]) -> None:
|
|
366
|
+
pushed.extend(items)
|
|
367
|
+
|
|
368
|
+
rows = [{'i': i} for i in range(3)]
|
|
369
|
+
result = await push_data_and_charge(mgr, rows, 'profile', True, push_fn)
|
|
370
|
+
|
|
371
|
+
assert len(pushed) == 3
|
|
372
|
+
assert result.charged_count == 3
|
|
373
|
+
assert result.event_charge_limit_reached is False
|
|
374
|
+
assert mgr.get_charged_event_count('profile') == 3
|
|
375
|
+
|
|
376
|
+
# Without an explicit event the default event alone is counted once.
|
|
377
|
+
result2 = await push_data_and_charge(mgr, rows, None, True, push_fn)
|
|
378
|
+
assert result2.charged_count == 3
|
|
@@ -286,7 +286,8 @@ async def test_explicit_and_default_dataset_events_are_each_reserved_once() -> N
|
|
|
286
286
|
)
|
|
287
287
|
|
|
288
288
|
assert len(pushed) == 2
|
|
289
|
-
|
|
289
|
+
# Rows charged (Apify parity), not rows x events: both events billed 2 each.
|
|
290
|
+
assert result.charged_count == 2
|
|
290
291
|
assert mgr.get_charged_event_count('page-open') == 2
|
|
291
292
|
assert mgr.get_charged_event_count('apify-default-dataset-item') == 2
|
|
292
293
|
assert mgr.get_total_charged_usd() == Decimal('0.04')
|
|
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
|
{scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/storage/_file_system/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/storage/scrapely_dataset_client.py
RENAMED
|
File without changes
|
{scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/storage/scrapely_kvs_client.py
RENAMED
|
File without changes
|
|
File without changes
|
{scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely/storage/scrapely_storage_client.py
RENAMED
|
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
|
{scrapely_python-0.1.9 → scrapely_python-0.1.10}/src/scrapely_python.egg-info/dependency_links.txt
RENAMED
|
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
|