scrapely-python 0.1.6__tar.gz → 0.1.9__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/LICENSE +21 -0
- scrapely_python-0.1.9/LICENSE-APACHE +201 -0
- scrapely_python-0.1.9/NOTICE +27 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/PKG-INFO +12 -2
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/README.md +6 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/pyproject.toml +3 -2
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/__init__.py +1 -1
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/actor.py +25 -10
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/charging.py +54 -6
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/configuration.py +21 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/events/_types.py +4 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/events/event_manager.py +4 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/proxy_configuration.py +47 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/request_loaders/_scrapely_request_list.py +4 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/storage/api_client.py +20 -3
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/storage/client.py +6 -1
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/storage/scrapely_rq_client.py +8 -4
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely_python.egg-info/PKG-INFO +12 -2
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely_python.egg-info/SOURCES.txt +5 -0
- scrapely_python-0.1.9/tests/test_charge_retries.py +141 -0
- scrapely_python-0.1.9/tests/test_input_proxy_aliases.py +98 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/tests/test_parity.py +21 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/tests/test_storage.py +17 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/setup.cfg +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/_browser_locations.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/browser_configuration.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/cdp_retry.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/charging_client.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/crypto/__init__.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/crypto/_secrets.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/errors.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/events/__init__.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/log.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/patch_browser_pool.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/pricing_types.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/py.typed +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/request_loaders/__init__.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/storage/__init__.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/storage/_file_system/__init__.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/storage/_file_system/_key_value_store_client.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/storage/_file_system/_storage_client.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/storage/_metadata.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/storage/patch_storage.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/storage/scrapely_dataset_client.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/storage/scrapely_kvs_client.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/storage/scrapely_storage_client.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/storage/smart_scrapely_storage_client.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/storage/types.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/storage/utils.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/storage_clients/__init__.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/storages/__init__.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/types.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely/webhook.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely_python.egg-info/dependency_links.txt +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely_python.egg-info/requires.txt +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/src/scrapely_python.egg-info/top_level.txt +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/tests/test_api_client_retries.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/tests/test_apify_parity.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/tests/test_browser_configuration.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/tests/test_cdp_retry.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/tests/test_charging_parity.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/tests/test_charging_pending.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/tests/test_patch_browser_pool.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/tests/test_proxy_configuration.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/tests/test_run_control.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/tests/test_secrets.py +0 -0
- {scrapely_python-0.1.6 → scrapely_python-0.1.9}/tests/test_terminal_status_message.py +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 TeraShift GmbH (Scrape.ly)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2018 Apify Technologies s.r.o.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Scrapely Python SDK
|
|
2
|
+
===================
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2025-2026 TeraShift GmbH (Scrape.ly).
|
|
5
|
+
|
|
6
|
+
This package is licensed under the MIT License (see LICENSE), except for
|
|
7
|
+
the files listed below, which are derived from apify-sdk-python
|
|
8
|
+
(https://github.com/apify/apify-sdk-python),
|
|
9
|
+
Copyright Apify Technologies s.r.o., licensed under the Apache License,
|
|
10
|
+
Version 2.0 (see LICENSE-APACHE). Those files have been modified by
|
|
11
|
+
TeraShift GmbH and remain under the Apache License, Version 2.0:
|
|
12
|
+
|
|
13
|
+
- src/scrapely/events/_types.py (from src/apify/events/_types.py)
|
|
14
|
+
- src/scrapely/events/event_manager.py (from src/apify/events/_apify_event_manager.py)
|
|
15
|
+
- src/scrapely/request_loaders/_scrapely_request_list.py
|
|
16
|
+
(from src/apify/request_loaders/_apify_request_list.py)
|
|
17
|
+
|
|
18
|
+
You may obtain a copy of the Apache License at
|
|
19
|
+
|
|
20
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
+
|
|
22
|
+
This product includes software developed by Apify Technologies s.r.o.
|
|
23
|
+
(https://apify.com/). The original source code is available at
|
|
24
|
+
https://github.com/apify/apify-sdk-python.
|
|
25
|
+
|
|
26
|
+
Scrape.ly is not affiliated with Apify. Apify is a trademark of
|
|
27
|
+
Apify Technologies s.r.o.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: scrapely-python
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.9
|
|
4
4
|
Summary: Scrapely Python SDK - A toolkit for building Actors on the Scrapely platform
|
|
5
5
|
Author-email: Scrapely <support@scrape.ly>
|
|
6
|
-
License-Expression: MIT
|
|
6
|
+
License-Expression: MIT AND Apache-2.0
|
|
7
7
|
Project-URL: Homepage, https://scrape.ly
|
|
8
8
|
Project-URL: Documentation, https://docs.scrape.ly
|
|
9
9
|
Project-URL: Repository, https://github.com/SandeepDev1/scrapely
|
|
@@ -18,6 +18,9 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
|
18
18
|
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
19
19
|
Requires-Python: >=3.11
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
License-File: LICENSE-APACHE
|
|
23
|
+
License-File: NOTICE
|
|
21
24
|
Requires-Dist: httpx>=0.25.0
|
|
22
25
|
Requires-Dist: crawlee<2.0.0,>=1.8.0
|
|
23
26
|
Requires-Dist: websockets>=12.0
|
|
@@ -32,6 +35,7 @@ Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
|
32
35
|
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
33
36
|
Requires-Dist: playwright>=1.40.0; extra == "dev"
|
|
34
37
|
Requires-Dist: browserforge>=1.2.0; extra == "dev"
|
|
38
|
+
Dynamic: license-file
|
|
35
39
|
|
|
36
40
|
# Scrapely Python SDK
|
|
37
41
|
|
|
@@ -80,3 +84,9 @@ if __name__ == "__main__":
|
|
|
80
84
|
- Apify-compatible environment aliases and asynchronous client access
|
|
81
85
|
|
|
82
86
|
See the [complete Python SDK guide](../docs/sdk-python.md) for lifecycle details, option objects, storage selection, events, CDP behavior, run control, environment variables, errors, and the full public export list.
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
|
|
90
|
+
MIT (see [LICENSE](./LICENSE)), except for three files derived from the Apache-2.0 licensed
|
|
91
|
+
[apify-sdk-python](https://github.com/apify/apify-sdk-python), which stay under the Apache License 2.0
|
|
92
|
+
(see [LICENSE-APACHE](./LICENSE-APACHE) and [NOTICE](./NOTICE)).
|
|
@@ -45,3 +45,9 @@ if __name__ == "__main__":
|
|
|
45
45
|
- Apify-compatible environment aliases and asynchronous client access
|
|
46
46
|
|
|
47
47
|
See the [complete Python SDK guide](../docs/sdk-python.md) for lifecycle details, option objects, storage selection, events, CDP behavior, run control, environment variables, errors, and the full public export list.
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
MIT (see [LICENSE](./LICENSE)), except for three files derived from the Apache-2.0 licensed
|
|
52
|
+
[apify-sdk-python](https://github.com/apify/apify-sdk-python), which stay under the Apache License 2.0
|
|
53
|
+
(see [LICENSE-APACHE](./LICENSE-APACHE) and [NOTICE](./NOTICE)).
|
|
@@ -4,10 +4,11 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "scrapely-python"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.9"
|
|
8
8
|
description = "Scrapely Python SDK - A toolkit for building Actors on the Scrapely platform"
|
|
9
9
|
readme = "README.md"
|
|
10
|
-
license = "MIT"
|
|
10
|
+
license = "MIT AND Apache-2.0"
|
|
11
|
+
license-files = ["LICENSE", "LICENSE-APACHE", "NOTICE"]
|
|
11
12
|
authors = [
|
|
12
13
|
{name = "Scrapely", email = "support@scrape.ly"}
|
|
13
14
|
]
|
|
@@ -27,6 +27,7 @@ from crawlee.storages import Dataset, KeyValueStore, RequestQueue
|
|
|
27
27
|
from .charging import ChargingManager, is_default_dataset_item_event, push_data_and_charge
|
|
28
28
|
from .configuration import Configuration
|
|
29
29
|
from .crypto import decrypt_secret_inputs
|
|
30
|
+
from .proxy_configuration import with_proxy_key_aliases
|
|
30
31
|
from crawlee.events import EventManager
|
|
31
32
|
|
|
32
33
|
from .events import Event, LocalEventManager, ScrapelyEventManager
|
|
@@ -484,8 +485,10 @@ class Actor(metaclass=_ActorMeta):
|
|
|
484
485
|
flush = getattr(cls._charging_manager, 'flush_pending', None)
|
|
485
486
|
if flush is not None:
|
|
486
487
|
deadline_ms = min(max(1, timeout_secs) * 1000, 30_000)
|
|
488
|
+
# The flush's own deadline ends its retries (charge POSTs back off
|
|
489
|
+
# for up to ~45 s) a little before wait_for would cancel it.
|
|
487
490
|
await asyncio.wait_for(
|
|
488
|
-
flush(max_intents=64, deadline_ms=deadline_ms),
|
|
491
|
+
flush(max_intents=64, deadline_ms=max(500, deadline_ms - 2_000)),
|
|
489
492
|
timeout=max(1.0, deadline_ms / 1000.0),
|
|
490
493
|
)
|
|
491
494
|
except BaseException as e:
|
|
@@ -604,11 +607,14 @@ class Actor(metaclass=_ActorMeta):
|
|
|
604
607
|
*,
|
|
605
608
|
status_message: Optional[str] = None,
|
|
606
609
|
exit_code: Optional[int] = None,
|
|
610
|
+
exception: Optional[BaseException] = None,
|
|
607
611
|
) -> None:
|
|
608
612
|
"""Fail the Actor run (exit code defaults to ``1``).
|
|
609
613
|
|
|
610
|
-
Apify-Python parity: supports keyword-only ``status_message
|
|
611
|
-
``exit_code``
|
|
614
|
+
Apify-Python parity: supports keyword-only ``status_message``,
|
|
615
|
+
``exit_code`` and ``exception`` arguments
|
|
616
|
+
(``await Actor.fail(status_message="Boom", exception=e)``). When
|
|
617
|
+
``exception`` is given its traceback is logged.
|
|
612
618
|
The pre-existing positional forms (``Actor.fail("message")`` /
|
|
613
619
|
``Actor.fail(ExitOptions(...))``) remain supported; explicit keyword
|
|
614
620
|
arguments take precedence over the positional values when provided.
|
|
@@ -632,7 +638,10 @@ class Actor(metaclass=_ActorMeta):
|
|
|
632
638
|
if exit_code is not None:
|
|
633
639
|
opts.exit_code = exit_code
|
|
634
640
|
|
|
635
|
-
logger.error(
|
|
641
|
+
logger.error(
|
|
642
|
+
f'[Scrapely] Actor failed: {opts.status_message or "Unknown error"}',
|
|
643
|
+
exc_info=exception,
|
|
644
|
+
)
|
|
636
645
|
await cls.exit(opts)
|
|
637
646
|
|
|
638
647
|
@classmethod
|
|
@@ -687,8 +696,8 @@ class Actor(metaclass=_ActorMeta):
|
|
|
687
696
|
kvs = await cls.open_key_value_store()
|
|
688
697
|
metamorph_input = await kvs.get_value(f'INPUT-METAMORPH-{count}')
|
|
689
698
|
if metamorph_input is not None:
|
|
690
|
-
cls._cached_input = metamorph_input
|
|
691
|
-
return cast(Dict[str, Any],
|
|
699
|
+
cls._cached_input = with_proxy_key_aliases(metamorph_input)
|
|
700
|
+
return cast(Dict[str, Any], cls._cached_input)
|
|
692
701
|
|
|
693
702
|
raw_input = os.environ.get('ACTOR_INPUT')
|
|
694
703
|
if raw_input:
|
|
@@ -701,7 +710,8 @@ class Actor(metaclass=_ActorMeta):
|
|
|
701
710
|
# path is decrypted, mirroring Actor.getInput() in the Node SDK)
|
|
702
711
|
if isinstance(parsed, dict):
|
|
703
712
|
parsed = decrypt_secret_inputs(parsed)
|
|
704
|
-
|
|
713
|
+
# Proxy objects carry both namings (scrapelyProxy* and apifyProxy*).
|
|
714
|
+
cls._cached_input = with_proxy_key_aliases(parsed)
|
|
705
715
|
return cast(Dict[str, Any], cls._cached_input)
|
|
706
716
|
|
|
707
717
|
kvs = await cls.open_key_value_store()
|
|
@@ -709,8 +719,8 @@ class Actor(metaclass=_ActorMeta):
|
|
|
709
719
|
result = await kvs.get_value(input_key)
|
|
710
720
|
if isinstance(result, dict):
|
|
711
721
|
result = decrypt_secret_inputs(result)
|
|
712
|
-
cls._cached_input = result
|
|
713
|
-
return cast(Optional[Dict[str, Any]],
|
|
722
|
+
cls._cached_input = with_proxy_key_aliases(result)
|
|
723
|
+
return cast(Optional[Dict[str, Any]], cls._cached_input)
|
|
714
724
|
|
|
715
725
|
@classmethod
|
|
716
726
|
async def get_input_or_throw(cls) -> Dict[str, Any]:
|
|
@@ -739,7 +749,7 @@ class Actor(metaclass=_ActorMeta):
|
|
|
739
749
|
|
|
740
750
|
# Decrypt secret inputs after loading (JS parity with Actor.input getter)
|
|
741
751
|
if isinstance(cls._cached_input, dict):
|
|
742
|
-
cls._cached_input = decrypt_secret_inputs(cls._cached_input)
|
|
752
|
+
cls._cached_input = with_proxy_key_aliases(decrypt_secret_inputs(cls._cached_input))
|
|
743
753
|
|
|
744
754
|
return cls._cached_input
|
|
745
755
|
|
|
@@ -1172,6 +1182,11 @@ class Actor(metaclass=_ActorMeta):
|
|
|
1172
1182
|
"""Return the Configuration instance."""
|
|
1173
1183
|
return cls.get_config()
|
|
1174
1184
|
|
|
1185
|
+
@_ClassProperty
|
|
1186
|
+
def config(cls) -> Configuration:
|
|
1187
|
+
"""Return the Configuration instance (Apify SDK ``Actor.config`` parity)."""
|
|
1188
|
+
return cls.get_config()
|
|
1189
|
+
|
|
1175
1190
|
@_ClassProperty
|
|
1176
1191
|
def event_manager(cls) -> Optional[EventManager]:
|
|
1177
1192
|
"""Return the EventManager instance."""
|
|
@@ -47,8 +47,16 @@ CHARGE_IDEMPOTENCY_SAFE_AGE_SECS = 30 * 24 * 60 * 60
|
|
|
47
47
|
# Soft cap on open unresolved intents. Refuse NEW billable charges when full.
|
|
48
48
|
_PENDING_MAX_ENTRIES = 1024
|
|
49
49
|
|
|
50
|
-
#
|
|
51
|
-
|
|
50
|
+
# Same-key POST attempts before leaving an intent pending / raising. The API
|
|
51
|
+
# client itself retries 5xx answers and refused or reset connections of these
|
|
52
|
+
# POSTs with its long backoff (0.5 s doubling to 8 s, about 45 s): re-sending
|
|
53
|
+
# is safe because every attempt carries the same Idempotency-Key. These outer
|
|
54
|
+
# attempts cover what the client gives up on quickly (timeouts, other
|
|
55
|
+
# transport errors), with the same backoff, within _RETRY_BUDGET_SECS.
|
|
56
|
+
_POST_ATTEMPTS = 8
|
|
57
|
+
|
|
58
|
+
# Outer retries stop once this much time has passed since the first attempt.
|
|
59
|
+
_RETRY_BUDGET_SECS = 60.0
|
|
52
60
|
|
|
53
61
|
# Local-only dataset collecting one entry per logical charge operation
|
|
54
62
|
# (JS ChargingManager LOCAL_CHARGING_LOG_DATASET_NAME parity).
|
|
@@ -160,6 +168,7 @@ class ChargingManager:
|
|
|
160
168
|
_PENDING_MAX_ENTRIES = _PENDING_MAX_ENTRIES
|
|
161
169
|
_IDEMPOTENCY_SAFE_AGE_SECS = CHARGE_IDEMPOTENCY_SAFE_AGE_SECS
|
|
162
170
|
_POST_ATTEMPTS = _POST_ATTEMPTS
|
|
171
|
+
_RETRY_BUDGET_SECS = _RETRY_BUDGET_SECS
|
|
163
172
|
|
|
164
173
|
def __init__(self, config: 'Configuration', client: 'ApiClient'):
|
|
165
174
|
"""Initialize the charging manager.
|
|
@@ -458,12 +467,14 @@ class ChargingManager:
|
|
|
458
467
|
"""
|
|
459
468
|
if self._client is None or not self._is_at_home or not self._actor_run_id:
|
|
460
469
|
return False
|
|
470
|
+
started = time.monotonic()
|
|
461
471
|
for attempt in range(self._POST_ATTEMPTS):
|
|
462
472
|
try:
|
|
463
473
|
await self._client.post(
|
|
464
474
|
f'/v2/actor-runs/{self._actor_run_id}/charge/void',
|
|
465
475
|
json_data={},
|
|
466
476
|
headers={'Idempotency-Key': operation_id},
|
|
477
|
+
idempotent=True,
|
|
467
478
|
)
|
|
468
479
|
self._unwind_reservation(event_name, reserved)
|
|
469
480
|
return True
|
|
@@ -478,8 +489,8 @@ class ChargingManager:
|
|
|
478
489
|
# 404: nothing to void; 409: already settled; 4xx auth: permanent.
|
|
479
490
|
if status is not None and 400 <= status < 500:
|
|
480
491
|
return False
|
|
481
|
-
if
|
|
482
|
-
|
|
492
|
+
if not await self._backoff_before_retry(attempt, started, err):
|
|
493
|
+
break
|
|
483
494
|
# Outcome unknown: keep the reservation and retry before the next push / at exit.
|
|
484
495
|
self._pending_voids.append((event_name, operation_id, reserved, not_found_means_voided))
|
|
485
496
|
logger.error('Void of charge %s (%r) not confirmed yet; will retry', operation_id, event_name)
|
|
@@ -528,6 +539,7 @@ class ChargingManager:
|
|
|
528
539
|
event_name: str,
|
|
529
540
|
count: int,
|
|
530
541
|
idempotency_key: str,
|
|
542
|
+
deadline: Optional[float] = None,
|
|
531
543
|
) -> Dict[str, Any]:
|
|
532
544
|
if self._client is None:
|
|
533
545
|
raise RuntimeError('ChargingManager has no API client; cannot post charge intent')
|
|
@@ -538,6 +550,8 @@ class ChargingManager:
|
|
|
538
550
|
'count': count,
|
|
539
551
|
},
|
|
540
552
|
headers={'Idempotency-Key': idempotency_key},
|
|
553
|
+
idempotent=True,
|
|
554
|
+
**({'retry_deadline': deadline} if deadline is not None else {}),
|
|
541
555
|
)
|
|
542
556
|
if isinstance(response, dict):
|
|
543
557
|
return response
|
|
@@ -550,25 +564,58 @@ class ChargingManager:
|
|
|
550
564
|
pass
|
|
551
565
|
return {}
|
|
552
566
|
|
|
567
|
+
async def _backoff_before_retry(
|
|
568
|
+
self, attempt: int, started: float, err: BaseException, deadline: Optional[float] = None
|
|
569
|
+
) -> bool:
|
|
570
|
+
"""Sleep before the next same-key attempt; False when no attempt is left.
|
|
571
|
+
|
|
572
|
+
A 5xx answer reaching this point was already retried by the API client
|
|
573
|
+
with its long backoff, so it ends the attempts. Timeouts and other
|
|
574
|
+
errors without an answer back off the same way (0.5 s doubling to 8 s)
|
|
575
|
+
while attempts and the retry budget last.
|
|
576
|
+
"""
|
|
577
|
+
from .storage.api_client import server_retry_delay
|
|
578
|
+
|
|
579
|
+
if attempt + 1 >= self._POST_ATTEMPTS:
|
|
580
|
+
return False
|
|
581
|
+
status = _http_status_of(err)
|
|
582
|
+
if status is not None and status >= 500:
|
|
583
|
+
return False
|
|
584
|
+
delay = server_retry_delay(attempt, None)
|
|
585
|
+
if time.monotonic() - started + delay > self._RETRY_BUDGET_SECS:
|
|
586
|
+
return False
|
|
587
|
+
if deadline is not None and time.monotonic() + delay > deadline:
|
|
588
|
+
return False
|
|
589
|
+
logger.warning('Charge request failed (%s); retrying in %.1fs', type(err).__name__, delay)
|
|
590
|
+
await asyncio.sleep(delay)
|
|
591
|
+
return True
|
|
592
|
+
|
|
553
593
|
async def _post_charge_with_retries(
|
|
554
594
|
self,
|
|
555
595
|
*,
|
|
556
596
|
event_name: str,
|
|
557
597
|
count: int,
|
|
558
598
|
idempotency_key: str,
|
|
599
|
+
deadline: Optional[float] = None,
|
|
559
600
|
) -> Optional[int]:
|
|
560
601
|
"""POST charge; return acceptedCount on success, None if uncertain.
|
|
561
602
|
|
|
603
|
+
``deadline`` (``time.monotonic()``) bounds every retry, the API
|
|
604
|
+
client's included, so a flush with a time budget ends with the intent
|
|
605
|
+
still pending instead of being cancelled mid-request.
|
|
606
|
+
|
|
562
607
|
Raises ChargeRejectedError for definitive platform rejections.
|
|
563
608
|
Same idempotency key on every attempt.
|
|
564
609
|
"""
|
|
565
610
|
last_error: Optional[BaseException] = None
|
|
611
|
+
started = time.monotonic()
|
|
566
612
|
for attempt in range(self._POST_ATTEMPTS):
|
|
567
613
|
try:
|
|
568
614
|
body = await self._post_charge_once(
|
|
569
615
|
event_name=event_name,
|
|
570
616
|
count=count,
|
|
571
617
|
idempotency_key=idempotency_key,
|
|
618
|
+
deadline=deadline,
|
|
572
619
|
)
|
|
573
620
|
return _read_accepted_count(body, count)
|
|
574
621
|
except Exception as e:
|
|
@@ -581,8 +628,8 @@ class ChargingManager:
|
|
|
581
628
|
)
|
|
582
629
|
if rejected is not None:
|
|
583
630
|
raise rejected from e
|
|
584
|
-
if attempt
|
|
585
|
-
|
|
631
|
+
if not await self._backoff_before_retry(attempt, started, e, deadline):
|
|
632
|
+
break
|
|
586
633
|
if last_error is not None:
|
|
587
634
|
logger.warning(
|
|
588
635
|
'Failed to record charge for event %s (count=%s, key=%s): %s',
|
|
@@ -638,6 +685,7 @@ class ChargingManager:
|
|
|
638
685
|
event_name=event_name,
|
|
639
686
|
count=count,
|
|
640
687
|
idempotency_key=idempotency_key,
|
|
688
|
+
deadline=deadline,
|
|
641
689
|
)
|
|
642
690
|
except ChargeRejectedError as err:
|
|
643
691
|
self._unwind_reservation(event_name, count)
|
|
@@ -145,6 +145,8 @@ class Configuration:
|
|
|
145
145
|
'proxy_hostname': 'proxy.scrape.ly',
|
|
146
146
|
'proxy_port': 8000,
|
|
147
147
|
'container_port': 4321,
|
|
148
|
+
# Apify parity: standby runs listen on ACTOR_STANDBY_PORT (4321 unless set).
|
|
149
|
+
'standby_port': 4321,
|
|
148
150
|
'container_url': 'http://localhost:4321',
|
|
149
151
|
'metamorph_after_sleep_millis': 300000,
|
|
150
152
|
'persist_state_interval_millis': 60000,
|
|
@@ -245,6 +247,25 @@ class Configuration:
|
|
|
245
247
|
"""
|
|
246
248
|
self._config[key] = value
|
|
247
249
|
|
|
250
|
+
def __getattr__(self, name: str) -> Any:
|
|
251
|
+
"""Attribute access to any known setting (Apify ``Actor.config.<field>`` parity).
|
|
252
|
+
|
|
253
|
+
``Actor.config.standby_port``, ``Actor.config.meta_origin`` and the other
|
|
254
|
+
keys this class reads from the environment resolve like ``get(name)``.
|
|
255
|
+
"""
|
|
256
|
+
if name.startswith('_'):
|
|
257
|
+
raise AttributeError(name)
|
|
258
|
+
known = name in self.DEFAULTS or name in self.ENV_MAP.values() or name in self.__dict__.get('_config', {})
|
|
259
|
+
if not known:
|
|
260
|
+
raise AttributeError(f'{type(self).__name__!r} object has no attribute {name!r}')
|
|
261
|
+
return self.get(name)
|
|
262
|
+
|
|
263
|
+
@property
|
|
264
|
+
def standby_port(self) -> int:
|
|
265
|
+
"""Port a standby run serves HTTP on (ACTOR_STANDBY_PORT, default 4321)."""
|
|
266
|
+
value = self.get('standby_port')
|
|
267
|
+
return value if isinstance(value, int) else 4321
|
|
268
|
+
|
|
248
269
|
@property
|
|
249
270
|
def token(self) -> Optional[str]:
|
|
250
271
|
"""Get the authentication token."""
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
# Derived from apify-sdk-python (src/apify/events/_types.py),
|
|
3
|
+
# Copyright Apify Technologies s.r.o., licensed under the Apache License 2.0.
|
|
4
|
+
# Modified by TeraShift GmbH. See LICENSE-APACHE and NOTICE.
|
|
1
5
|
"""Scrapely event types - extends Crawlee's event types with Scrapely-specific data models."""
|
|
2
6
|
|
|
3
7
|
from __future__ import annotations
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
# Derived from apify-sdk-python (src/apify/events/_apify_event_manager.py),
|
|
3
|
+
# Copyright Apify Technologies s.r.o., licensed under the Apache License 2.0.
|
|
4
|
+
# Modified by TeraShift GmbH. See LICENSE-APACHE and NOTICE.
|
|
1
5
|
"""Event manager for Scrapely Actors.
|
|
2
6
|
|
|
3
7
|
Extends Crawlee's EventManager with WebSocket connectivity to the Scrapely platform
|