scrapely-python 0.1.21__py3-none-any.whl → 0.1.22__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 +1 -1
- scrapely/actor.py +18 -4
- {scrapely_python-0.1.21.dist-info → scrapely_python-0.1.22.dist-info}/METADATA +1 -1
- {scrapely_python-0.1.21.dist-info → scrapely_python-0.1.22.dist-info}/RECORD +9 -9
- {scrapely_python-0.1.21.dist-info → scrapely_python-0.1.22.dist-info}/WHEEL +0 -0
- {scrapely_python-0.1.21.dist-info → scrapely_python-0.1.22.dist-info}/licenses/LICENSE +0 -0
- {scrapely_python-0.1.21.dist-info → scrapely_python-0.1.22.dist-info}/licenses/LICENSE-APACHE +0 -0
- {scrapely_python-0.1.21.dist-info → scrapely_python-0.1.22.dist-info}/licenses/NOTICE +0 -0
- {scrapely_python-0.1.21.dist-info → scrapely_python-0.1.22.dist-info}/top_level.txt +0 -0
scrapely/__init__.py
CHANGED
scrapely/actor.py
CHANGED
|
@@ -784,6 +784,7 @@ class Actor(metaclass=_ActorMeta):
|
|
|
784
784
|
event_name: Optional[str] = None,
|
|
785
785
|
charges: Optional[Dict[str, int]] = None,
|
|
786
786
|
charge_per: str = 'row',
|
|
787
|
+
dataset: Optional[Union[str, Dataset]] = None,
|
|
787
788
|
) -> ChargeResult:
|
|
788
789
|
"""Push data to the default dataset, charging pay-per-event items.
|
|
789
790
|
|
|
@@ -807,6 +808,12 @@ class Actor(metaclass=_ActorMeta):
|
|
|
807
808
|
charges them once for the whole push, e.g.
|
|
808
809
|
``push_data(page_rows, charges={'document': 1}, charge_per='batch')``:
|
|
809
810
|
all rows are stored if the charge is accepted, none if it is refused.
|
|
811
|
+
dataset: Push to this named dataset (name, or a Dataset from ``open_dataset``)
|
|
812
|
+
instead of the default one, with the same charge-first semantics:
|
|
813
|
+
``push_data(rows, charged_event_name='comment', dataset=f'comments-{run_id}')``.
|
|
814
|
+
Rows of a named dataset carry no implicit default-dataset-item event and are
|
|
815
|
+
not gated by the default dataset's spending-limit safety net; charged pushes
|
|
816
|
+
store only the rows that were charged.
|
|
810
817
|
|
|
811
818
|
Returns:
|
|
812
819
|
ChargeResult describing how many items were charged and pushed.
|
|
@@ -827,6 +834,13 @@ class Actor(metaclass=_ActorMeta):
|
|
|
827
834
|
if cls._default_dataset is None:
|
|
828
835
|
cls._default_dataset = await cls.open_dataset()
|
|
829
836
|
|
|
837
|
+
target = cls._default_dataset
|
|
838
|
+
if dataset is not None:
|
|
839
|
+
target = dataset if isinstance(dataset, Dataset) else await cls.open_dataset(name=dataset)
|
|
840
|
+
is_default = target is cls._default_dataset or (
|
|
841
|
+
getattr(target, 'id', None) is not None and target.id == getattr(cls._default_dataset, 'id', None)
|
|
842
|
+
)
|
|
843
|
+
|
|
830
844
|
items = data if isinstance(data, list) else [data]
|
|
831
845
|
charging_manager = cls.get_charging_manager()
|
|
832
846
|
if charges is not None:
|
|
@@ -836,8 +850,8 @@ class Actor(metaclass=_ActorMeta):
|
|
|
836
850
|
charging_manager,
|
|
837
851
|
items,
|
|
838
852
|
charges,
|
|
839
|
-
|
|
840
|
-
|
|
853
|
+
is_default,
|
|
854
|
+
target.push_data,
|
|
841
855
|
charge_per=charge_per,
|
|
842
856
|
)
|
|
843
857
|
if charge_per != 'row':
|
|
@@ -846,8 +860,8 @@ class Actor(metaclass=_ActorMeta):
|
|
|
846
860
|
charging_manager,
|
|
847
861
|
items,
|
|
848
862
|
event_name,
|
|
849
|
-
|
|
850
|
-
|
|
863
|
+
is_default,
|
|
864
|
+
target.push_data,
|
|
851
865
|
)
|
|
852
866
|
|
|
853
867
|
@classmethod
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
scrapely/__init__.py,sha256=
|
|
1
|
+
scrapely/__init__.py,sha256=cxlsfPD_FlaCCerWYImS5rGRnKxE9INU61hDl3C04Y0,5746
|
|
2
2
|
scrapely/_browser_locations.py,sha256=8QVVnkms2bDn3_LDYgYDR59MvFx8757l_JYnZ7xb3oI,145269
|
|
3
|
-
scrapely/actor.py,sha256=
|
|
3
|
+
scrapely/actor.py,sha256=yLy05XzoFwslw0D4aSM38rDIGd81JvPqpngY467hWxQ,82969
|
|
4
4
|
scrapely/browser_configuration.py,sha256=jAZapNSHLFW05B96df4wNBtcyiiU9DA3ml0yTL1FwfA,5770
|
|
5
5
|
scrapely/cdp_retry.py,sha256=hdTJEAIKhApM7IOk1DrQEl8NoflSJSmqd4RbNJ2IsgI,8540
|
|
6
6
|
scrapely/charging.py,sha256=ns-kuUJtl8hBI4-3iBisC62BggJG67yYOa1yVVItoUI,83800
|
|
@@ -39,10 +39,10 @@ scrapely/storage/_file_system/_key_value_store_client.py,sha256=4Ipgbh4qEqAkwQJ9
|
|
|
39
39
|
scrapely/storage/_file_system/_storage_client.py,sha256=aaGJ4P0QAtIgEMl6yHpuobeWFD5M4rMC5HwhOOvuGuo,1794
|
|
40
40
|
scrapely/storage_clients/__init__.py,sha256=cs1YX7JV2_GKBXeiiJgkQFali08b5_y_jH6Yw7iROAA,656
|
|
41
41
|
scrapely/storages/__init__.py,sha256=4PAELhJNZ3exJ7Uouicn-bCQ58NafKjhLBixQ8ATQc4,173
|
|
42
|
-
scrapely_python-0.1.
|
|
43
|
-
scrapely_python-0.1.
|
|
44
|
-
scrapely_python-0.1.
|
|
45
|
-
scrapely_python-0.1.
|
|
46
|
-
scrapely_python-0.1.
|
|
47
|
-
scrapely_python-0.1.
|
|
48
|
-
scrapely_python-0.1.
|
|
42
|
+
scrapely_python-0.1.22.dist-info/licenses/LICENSE,sha256=pQGY0XwjIYh-a2HfawxHq1en53bXkFkDj2Q70jKWHr4,1088
|
|
43
|
+
scrapely_python-0.1.22.dist-info/licenses/LICENSE-APACHE,sha256=N8m0FzMq8i4UbTgXZvKEZJSD-27OF8pWZYS_atz4kTU,11355
|
|
44
|
+
scrapely_python-0.1.22.dist-info/licenses/NOTICE,sha256=DEsNrw6UdSIqdYYqMWVFgJnyt6jUivTD7iFU6YM_e1A,1122
|
|
45
|
+
scrapely_python-0.1.22.dist-info/METADATA,sha256=K-JZZELeDs7kIXmXodCXXVF3YCvozeqESmkQ5StszVw,3487
|
|
46
|
+
scrapely_python-0.1.22.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
47
|
+
scrapely_python-0.1.22.dist-info/top_level.txt,sha256=T4B9UMrs4q99QSAFyD1zdXhl40KnLhBKqrDkPhOTsmY,9
|
|
48
|
+
scrapely_python-0.1.22.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{scrapely_python-0.1.21.dist-info → scrapely_python-0.1.22.dist-info}/licenses/LICENSE-APACHE
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|