frankensurf 0.25.0__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.
- frankensurf-0.25.0/LICENSE +202 -0
- frankensurf-0.25.0/PKG-INFO +201 -0
- frankensurf-0.25.0/README.rst +162 -0
- frankensurf-0.25.0/pyproject.toml +51 -0
- frankensurf-0.25.0/setup.cfg +4 -0
- frankensurf-0.25.0/src/frankensurf/__init__.py +13 -0
- frankensurf-0.25.0/src/frankensurf/actions.py +38 -0
- frankensurf-0.25.0/src/frankensurf/adapters.py +148 -0
- frankensurf-0.25.0/src/frankensurf/bot_auth.py +146 -0
- frankensurf-0.25.0/src/frankensurf/browser_use_action_provider.py +209 -0
- frankensurf-0.25.0/src/frankensurf/browser_use_action_worker.py +989 -0
- frankensurf-0.25.0/src/frankensurf/browser_use_binding.py +34 -0
- frankensurf-0.25.0/src/frankensurf/browser_use_config.py +215 -0
- frankensurf-0.25.0/src/frankensurf/browser_use_provider.py +397 -0
- frankensurf-0.25.0/src/frankensurf/browser_use_worker.py +542 -0
- frankensurf-0.25.0/src/frankensurf/bundled_route_seeds.json +823 -0
- frankensurf-0.25.0/src/frankensurf/bundled_routes.json +4 -0
- frankensurf-0.25.0/src/frankensurf/cli.py +540 -0
- frankensurf-0.25.0/src/frankensurf/completeness.py +321 -0
- frankensurf-0.25.0/src/frankensurf/crawl4ai_config.py +661 -0
- frankensurf-0.25.0/src/frankensurf/crawl4ai_provider.py +335 -0
- frankensurf-0.25.0/src/frankensurf/crawl4ai_worker.py +429 -0
- frankensurf-0.25.0/src/frankensurf/experimental.py +227 -0
- frankensurf-0.25.0/src/frankensurf/handoff.py +148 -0
- frankensurf-0.25.0/src/frankensurf/hosted_providers.py +711 -0
- frankensurf-0.25.0/src/frankensurf/identity.py +590 -0
- frankensurf-0.25.0/src/frankensurf/identity_snapshots.py +351 -0
- frankensurf-0.25.0/src/frankensurf/managed_browsers.py +310 -0
- frankensurf-0.25.0/src/frankensurf/mcp_server.py +330 -0
- frankensurf-0.25.0/src/frankensurf/pagination.py +463 -0
- frankensurf-0.25.0/src/frankensurf/plugin_catalog.py +1760 -0
- frankensurf-0.25.0/src/frankensurf/profiles.py +268 -0
- frankensurf-0.25.0/src/frankensurf/provider_requirements.txt +5 -0
- frankensurf-0.25.0/src/frankensurf/provider_worker.py +476 -0
- frankensurf-0.25.0/src/frankensurf/providers.py +1768 -0
- frankensurf-0.25.0/src/frankensurf/public_entry.py +47 -0
- frankensurf-0.25.0/src/frankensurf/recovery.py +53 -0
- frankensurf-0.25.0/src/frankensurf/repair.py +1543 -0
- frankensurf-0.25.0/src/frankensurf/route_memory.py +752 -0
- frankensurf-0.25.0/src/frankensurf/routes.py +542 -0
- frankensurf-0.25.0/src/frankensurf/runtime.py +4553 -0
- frankensurf-0.25.0/src/frankensurf/scrapling_ready.py +36 -0
- frankensurf-0.25.0/src/frankensurf/search.py +70 -0
- frankensurf-0.25.0/src/frankensurf/search_plugins.py +807 -0
- frankensurf-0.25.0/src/frankensurf/site_modules.py +894 -0
- frankensurf-0.25.0/src/frankensurf/web_do.py +502 -0
- frankensurf-0.25.0/src/frankensurf.egg-info/PKG-INFO +201 -0
- frankensurf-0.25.0/src/frankensurf.egg-info/SOURCES.txt +132 -0
- frankensurf-0.25.0/src/frankensurf.egg-info/dependency_links.txt +1 -0
- frankensurf-0.25.0/src/frankensurf.egg-info/entry_points.txt +3 -0
- frankensurf-0.25.0/src/frankensurf.egg-info/requires.txt +15 -0
- frankensurf-0.25.0/src/frankensurf.egg-info/top_level.txt +1 -0
- frankensurf-0.25.0/tests/test_action_policy.py +121 -0
- frankensurf-0.25.0/tests/test_adapter_failure_evidence.py +38 -0
- frankensurf-0.25.0/tests/test_adapter_plugins.py +91 -0
- frankensurf-0.25.0/tests/test_agentbench.py +136 -0
- frankensurf-0.25.0/tests/test_attempt_costs.py +246 -0
- frankensurf-0.25.0/tests/test_authenticated_provider.py +685 -0
- frankensurf-0.25.0/tests/test_bot_auth.py +104 -0
- frankensurf-0.25.0/tests/test_browser_use_config.py +111 -0
- frankensurf-0.25.0/tests/test_browser_use_provider.py +422 -0
- frankensurf-0.25.0/tests/test_bundled_routes.py +42 -0
- frankensurf-0.25.0/tests/test_camoufox_direct_challenge.py +49 -0
- frankensurf-0.25.0/tests/test_cards.py +79 -0
- frankensurf-0.25.0/tests/test_cli_routes.py +136 -0
- frankensurf-0.25.0/tests/test_cli_setup_explain.py +61 -0
- frankensurf-0.25.0/tests/test_completeness.py +126 -0
- frankensurf-0.25.0/tests/test_crawl4ai_installer.py +299 -0
- frankensurf-0.25.0/tests/test_crawl4ai_provider.py +701 -0
- frankensurf-0.25.0/tests/test_escalation.py +124 -0
- frankensurf-0.25.0/tests/test_experimental_providers.py +309 -0
- frankensurf-0.25.0/tests/test_fake_walls.py +129 -0
- frankensurf-0.25.0/tests/test_handoff.py +123 -0
- frankensurf-0.25.0/tests/test_hosted_providers.py +250 -0
- frankensurf-0.25.0/tests/test_http_status_failures.py +55 -0
- frankensurf-0.25.0/tests/test_identity_authority.py +292 -0
- frankensurf-0.25.0/tests/test_identity_cache_health.py +83 -0
- frankensurf-0.25.0/tests/test_identity_interfaces.py +172 -0
- frankensurf-0.25.0/tests/test_identity_runtime.py +302 -0
- frankensurf-0.25.0/tests/test_import_image_evidence.py +36 -0
- frankensurf-0.25.0/tests/test_local_services.py +308 -0
- frankensurf-0.25.0/tests/test_managed_browsers.py +122 -0
- frankensurf-0.25.0/tests/test_markdown_negotiation.py +37 -0
- frankensurf-0.25.0/tests/test_mcp_acquisition_policy.py +52 -0
- frankensurf-0.25.0/tests/test_mcp_image_import.py +60 -0
- frankensurf-0.25.0/tests/test_more_providers.py +173 -0
- frankensurf-0.25.0/tests/test_native_sequence_recipes.py +333 -0
- frankensurf-0.25.0/tests/test_ndjson_content.py +25 -0
- frankensurf-0.25.0/tests/test_origin_pacing.py +87 -0
- frankensurf-0.25.0/tests/test_owner_visible_snapshot.py +402 -0
- frankensurf-0.25.0/tests/test_page_data_capture.py +65 -0
- frankensurf-0.25.0/tests/test_page_data_capture_browser.py +67 -0
- frankensurf-0.25.0/tests/test_pagination.py +89 -0
- frankensurf-0.25.0/tests/test_pdf_text.py +65 -0
- frankensurf-0.25.0/tests/test_plugin_catalog.py +303 -0
- frankensurf-0.25.0/tests/test_policy_escalation.py +72 -0
- frankensurf-0.25.0/tests/test_policy_resources.py +97 -0
- frankensurf-0.25.0/tests/test_prepare_local_identity.py +55 -0
- frankensurf-0.25.0/tests/test_profiles.py +137 -0
- frankensurf-0.25.0/tests/test_provider_deadlines.py +97 -0
- frankensurf-0.25.0/tests/test_provider_plan.py +549 -0
- frankensurf-0.25.0/tests/test_provider_plugins.py +1685 -0
- frankensurf-0.25.0/tests/test_public_entry.py +53 -0
- frankensurf-0.25.0/tests/test_public_image_recovery.py +48 -0
- frankensurf-0.25.0/tests/test_recovery_handoff.py +54 -0
- frankensurf-0.25.0/tests/test_repair_operation.py +583 -0
- frankensurf-0.25.0/tests/test_response_url_evidence.py +266 -0
- frankensurf-0.25.0/tests/test_route_memory.py +648 -0
- frankensurf-0.25.0/tests/test_route_recipes.py +444 -0
- frankensurf-0.25.0/tests/test_runtime.py +152 -0
- frankensurf-0.25.0/tests/test_runtime_plugin_catalog.py +893 -0
- frankensurf-0.25.0/tests/test_scoreboard.py +36 -0
- frankensurf-0.25.0/tests/test_scrapling_challenge_policy.py +87 -0
- frankensurf-0.25.0/tests/test_scrapling_ready.py +36 -0
- frankensurf-0.25.0/tests/test_search_import.py +87 -0
- frankensurf-0.25.0/tests/test_search_plugins.py +671 -0
- frankensurf-0.25.0/tests/test_second_opinion.py +73 -0
- frankensurf-0.25.0/tests/test_site_module_repair.py +88 -0
- frankensurf-0.25.0/tests/test_site_modules.py +240 -0
- frankensurf-0.25.0/tests/test_sitebench.py +114 -0
- frankensurf-0.25.0/tests/test_steel_lifecycle.py +37 -0
- frankensurf-0.25.0/tests/test_substrate_boundary.py +49 -0
- frankensurf-0.25.0/tests/test_thin_content.py +106 -0
- frankensurf-0.25.0/tests/test_toolbench.py +59 -0
- frankensurf-0.25.0/tests/test_try_harder.py +64 -0
- frankensurf-0.25.0/tests/test_wall_detection.py +28 -0
- frankensurf-0.25.0/tests/test_watch.py +52 -0
- frankensurf-0.25.0/tests/test_web_do.py +392 -0
- frankensurf-0.25.0/tests/test_web_do_browser_use.py +751 -0
- frankensurf-0.25.0/tests/test_web_do_raw_core.py +544 -0
- frankensurf-0.25.0/tests/test_worker_failure_url.py +23 -0
- frankensurf-0.25.0/tests/test_worker_json_capture.py +23 -0
- frankensurf-0.25.0/tests/test_worker_page_failure.py +29 -0
- frankensurf-0.25.0/tests/test_wrong_pages.py +142 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: frankensurf
|
|
3
|
+
Version: 0.25.0
|
|
4
|
+
Summary: One read() call for AI agents, stitched from 28 web tools: cheapest first, every page checked, a receipt for every attempt
|
|
5
|
+
Author: yail259
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://frankensurf.dev
|
|
8
|
+
Project-URL: Documentation, https://frankensurf.dev/docs/
|
|
9
|
+
Project-URL: Repository, https://github.com/yail259/frankensurf
|
|
10
|
+
Project-URL: Issues, https://github.com/yail259/frankensurf/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/yail259/frankensurf/releases
|
|
12
|
+
Keywords: web scraping,ai agents,mcp,browser automation,crawler,playwright,llm
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
22
|
+
Requires-Python: >=3.12
|
|
23
|
+
Description-Content-Type: text/x-rst
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: httpx<1,>=0.28
|
|
26
|
+
Requires-Dist: beautifulsoup4<5,>=4.13
|
|
27
|
+
Requires-Dist: playwright<2,>=1.63
|
|
28
|
+
Requires-Dist: Pillow<13,>=12
|
|
29
|
+
Requires-Dist: tiktoken<1,>=0.14
|
|
30
|
+
Requires-Dist: jsonschema<5,>=4.23
|
|
31
|
+
Requires-Dist: pypdf<7,>=6
|
|
32
|
+
Requires-Dist: cryptography>=44
|
|
33
|
+
Provides-Extra: test
|
|
34
|
+
Requires-Dist: pytest<10,>=9; extra == "test"
|
|
35
|
+
Requires-Dist: pytest-asyncio<2,>=1; extra == "test"
|
|
36
|
+
Provides-Extra: mcp
|
|
37
|
+
Requires-Dist: mcp<2,>=1.2; extra == "mcp"
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
|
|
40
|
+
Frankensurf
|
|
41
|
+
===========
|
|
42
|
+
|
|
43
|
+
**One read() call for AI agents, stitched from 28 web tools.**
|
|
44
|
+
|
|
45
|
+
Every web tool breaks somewhere. Frankensurf sits in front of all of them and
|
|
46
|
+
gives your agent one call. It tries the cheapest tool first, checks the page is
|
|
47
|
+
real, climbs to a stronger tool only when a site pushes back, and returns clean
|
|
48
|
+
page data with a receipt of how it got there.
|
|
49
|
+
|
|
50
|
+
- **Cheapest first.** Plain HTTP, Jina Reader, a local browser, free stealth
|
|
51
|
+
browsers, hosted browsers, then paid unblockers only if you allow them.
|
|
52
|
+
- **Every page checked.** A challenge page, a login wall, or a search page whose
|
|
53
|
+
results never loaded counts as a failure, not a success.
|
|
54
|
+
- **Shows its work.** Every result says which tools ran, how long each took and
|
|
55
|
+
what it cost.
|
|
56
|
+
|
|
57
|
+
Website and docs: https://frankensurf.dev ·
|
|
58
|
+
`Why I built it <https://frankensurf.dev/blog/i-just-wanted-a-cheap-film-camera/>`_
|
|
59
|
+
|
|
60
|
+
Try it
|
|
61
|
+
------
|
|
62
|
+
|
|
63
|
+
Python 3.12 or newer, on Linux or Windows through WSL (macOS should work but
|
|
64
|
+
isn't tested yet)::
|
|
65
|
+
|
|
66
|
+
pip install "frankensurf[mcp]"
|
|
67
|
+
frankensurf setup # Chromium + the free stealth browsers, a few minutes
|
|
68
|
+
frankensurf read "https://www.walmart.com/search?q=air+fryer" --explain
|
|
69
|
+
|
|
70
|
+
No account or key needed. The read climbs until it gets the real page::
|
|
71
|
+
|
|
72
|
+
https://www.walmart.com/search?q=air+fryer
|
|
73
|
+
✗ http CAPTCHA 0.4s
|
|
74
|
+
✗ local CAPTCHA 1.5s
|
|
75
|
+
✓ camoufox got the page 15.6s
|
|
76
|
+
|
|
77
|
+
air fryer - Walmart.com
|
|
78
|
+
24,192 characters via camoufox, complete (107 results), free
|
|
79
|
+
|
|
80
|
+
Drop ``--explain`` for the full JSON: text or markdown, JSON-LD, the page's
|
|
81
|
+
embedded and fetched JSON, images, and the receipt.
|
|
82
|
+
|
|
83
|
+
Free or paid
|
|
84
|
+
------------
|
|
85
|
+
|
|
86
|
+
Everything works with no keys. Paid tools are opt-in, and only run after the
|
|
87
|
+
free ones fail. From the benchmark below (152 sites picked before any was read):
|
|
88
|
+
|
|
89
|
+
========================================= ============== =============
|
|
90
|
+
Setup Sites read Cost per 1k
|
|
91
|
+
========================================= ============== =============
|
|
92
|
+
Free tools only (``frankensurf setup``) 73.7% $0
|
|
93
|
+
Plus paid fallbacks (Firecrawl, Zyte, …) 89.5% $0.73
|
|
94
|
+
========================================= ============== =============
|
|
95
|
+
|
|
96
|
+
To allow paid tools, set their keys (for example ``FIRECRAWL_API_KEY``) and pass
|
|
97
|
+
``allow_paid_fallbacks``. See
|
|
98
|
+
`Paid tools and budgets <https://frankensurf.dev/docs/blocked/paid-tools/>`_.
|
|
99
|
+
|
|
100
|
+
Use it
|
|
101
|
+
------
|
|
102
|
+
|
|
103
|
+
From an agent, as an MCP server
|
|
104
|
+
(`setup for each client <https://frankensurf.dev/docs/agents/>`_)::
|
|
105
|
+
|
|
106
|
+
claude mcp add frankensurf -- frankensurf-mcp
|
|
107
|
+
|
|
108
|
+
From Python::
|
|
109
|
+
|
|
110
|
+
from frankensurf import Runtime
|
|
111
|
+
|
|
112
|
+
async with Runtime("state") as web:
|
|
113
|
+
page = await web.read("https://example.com", policy_overrides={"prefer_markdown": True})
|
|
114
|
+
hits = await web.search("playwright python tutorial")
|
|
115
|
+
|
|
116
|
+
From the command line::
|
|
117
|
+
|
|
118
|
+
frankensurf read https://example.com --markdown
|
|
119
|
+
frankensurf search playwright python tutorial
|
|
120
|
+
frankensurf watch https://news.ycombinator.com/ --link-pattern 'item\?id=\d+'
|
|
121
|
+
|
|
122
|
+
What you get back is raw page data, not answers. Your agent decides what the page
|
|
123
|
+
means, and if it isn't what it wanted, it can ask again with
|
|
124
|
+
``retry_of=<trace_id>`` to skip every tool already tried.
|
|
125
|
+
|
|
126
|
+
Also in the box: profiles (log in once, reuse the session from any tool), human
|
|
127
|
+
handoff for CAPTCHAs and 2FA, site modules (save what your agent learns about a
|
|
128
|
+
site as data), and Web Bot Auth request signing.
|
|
129
|
+
|
|
130
|
+
How it works
|
|
131
|
+
------------
|
|
132
|
+
|
|
133
|
+
Every way to fetch a page is a rung: plain HTTP and markdown negotiation,
|
|
134
|
+
browsers, stealth browsers and signed requests, hosted browsers, paid unblockers,
|
|
135
|
+
and finally a person clearing the wall in a visible browser. A read starts at the
|
|
136
|
+
cheapest rung and climbs only when a page pushes back. Every tool is a plugin, so
|
|
137
|
+
new ones slot in as another rung. See
|
|
138
|
+
`How escalation works <https://frankensurf.dev/docs/blocked/escalation/>`_
|
|
139
|
+
and the `full list of integrations <https://frankensurf.dev/docs/integrations/>`_.
|
|
140
|
+
|
|
141
|
+
Benchmark
|
|
142
|
+
---------
|
|
143
|
+
|
|
144
|
+
``scripts/toolbench.py`` runs each tool on its own, then Frankensurf, on the same
|
|
145
|
+
pages with the same content checks. 152 sites picked before any was read, one run
|
|
146
|
+
on 6 October 2026, raw rows in ``benchmarks/2026-10-06/``:
|
|
147
|
+
|
|
148
|
+
========================== ===========
|
|
149
|
+
Tool Sites read
|
|
150
|
+
========================== ===========
|
|
151
|
+
Headless Chromium only 32.2%
|
|
152
|
+
Plain HTTP only 46.1%
|
|
153
|
+
Camoufox only 48.7%
|
|
154
|
+
Scrapling only 53.3%
|
|
155
|
+
ZenRows only 55.3%
|
|
156
|
+
Jina Reader only 63.8%
|
|
157
|
+
Zyte only 73.7%
|
|
158
|
+
Firecrawl only 80.3%
|
|
159
|
+
**Frankensurf** **89.5%**
|
|
160
|
+
========================== ===========
|
|
161
|
+
|
|
162
|
+
Frankensurf read 19 sites Firecrawl missed and Firecrawl read 5 Frankensurf
|
|
163
|
+
missed. Frankensurf costs a fifth as much per page, but is slower: median 9.5 s
|
|
164
|
+
against 5.6 s. Scrapfly is left out because its free plan ran out mid-run. See
|
|
165
|
+
`Benchmarks <https://frankensurf.dev/docs/more/benchmarks/>`_.
|
|
166
|
+
|
|
167
|
+
Known walls
|
|
168
|
+
-----------
|
|
169
|
+
|
|
170
|
+
It's an alpha, and some sites still win:
|
|
171
|
+
|
|
172
|
+
- **Need the paid tools:** in a free-only spot check on 9 October, Etsy, Home
|
|
173
|
+
Depot, Yelp, Crunchbase and G2 blocked every free tool.
|
|
174
|
+
- **Beat everything so far:** Shopee, Temu and Idealista.
|
|
175
|
+
- **Logged-in pages** (your feeds, your orders) need a
|
|
176
|
+
`profile <https://frankensurf.dev/docs/read/profiles/>`_.
|
|
177
|
+
- **Slower than one tool:** a read that climbs several rungs takes 10–30 s.
|
|
178
|
+
|
|
179
|
+
Found a site it can't read?
|
|
180
|
+
`Report it <https://github.com/yail259/frankensurf/issues/new?template=site-it-cant-read.yml>`_;
|
|
181
|
+
every report becomes a test case.
|
|
182
|
+
|
|
183
|
+
Develop
|
|
184
|
+
-------
|
|
185
|
+
|
|
186
|
+
From a clone::
|
|
187
|
+
|
|
188
|
+
python3 -m venv .venv
|
|
189
|
+
.venv/bin/pip install -e '.[test,mcp]'
|
|
190
|
+
.venv/bin/frankensurf setup
|
|
191
|
+
PYTHONPATH=.:src .venv/bin/pytest -q
|
|
192
|
+
|
|
193
|
+
The product design is in ``SPEC.rst``; contributor rules are in ``AGENTS.md``.
|
|
194
|
+
New tools are plugins, never branches in Core; see
|
|
195
|
+
`Writing a plugin <https://frankensurf.dev/docs/more/plugins/>`_. The
|
|
196
|
+
website and docs live in ``site/``.
|
|
197
|
+
|
|
198
|
+
Licence
|
|
199
|
+
-------
|
|
200
|
+
|
|
201
|
+
Apache-2.0. See ``LICENSE``.
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
Frankensurf
|
|
2
|
+
===========
|
|
3
|
+
|
|
4
|
+
**One read() call for AI agents, stitched from 28 web tools.**
|
|
5
|
+
|
|
6
|
+
Every web tool breaks somewhere. Frankensurf sits in front of all of them and
|
|
7
|
+
gives your agent one call. It tries the cheapest tool first, checks the page is
|
|
8
|
+
real, climbs to a stronger tool only when a site pushes back, and returns clean
|
|
9
|
+
page data with a receipt of how it got there.
|
|
10
|
+
|
|
11
|
+
- **Cheapest first.** Plain HTTP, Jina Reader, a local browser, free stealth
|
|
12
|
+
browsers, hosted browsers, then paid unblockers only if you allow them.
|
|
13
|
+
- **Every page checked.** A challenge page, a login wall, or a search page whose
|
|
14
|
+
results never loaded counts as a failure, not a success.
|
|
15
|
+
- **Shows its work.** Every result says which tools ran, how long each took and
|
|
16
|
+
what it cost.
|
|
17
|
+
|
|
18
|
+
Website and docs: https://frankensurf.dev ·
|
|
19
|
+
`Why I built it <https://frankensurf.dev/blog/i-just-wanted-a-cheap-film-camera/>`_
|
|
20
|
+
|
|
21
|
+
Try it
|
|
22
|
+
------
|
|
23
|
+
|
|
24
|
+
Python 3.12 or newer, on Linux or Windows through WSL (macOS should work but
|
|
25
|
+
isn't tested yet)::
|
|
26
|
+
|
|
27
|
+
pip install "frankensurf[mcp]"
|
|
28
|
+
frankensurf setup # Chromium + the free stealth browsers, a few minutes
|
|
29
|
+
frankensurf read "https://www.walmart.com/search?q=air+fryer" --explain
|
|
30
|
+
|
|
31
|
+
No account or key needed. The read climbs until it gets the real page::
|
|
32
|
+
|
|
33
|
+
https://www.walmart.com/search?q=air+fryer
|
|
34
|
+
✗ http CAPTCHA 0.4s
|
|
35
|
+
✗ local CAPTCHA 1.5s
|
|
36
|
+
✓ camoufox got the page 15.6s
|
|
37
|
+
|
|
38
|
+
air fryer - Walmart.com
|
|
39
|
+
24,192 characters via camoufox, complete (107 results), free
|
|
40
|
+
|
|
41
|
+
Drop ``--explain`` for the full JSON: text or markdown, JSON-LD, the page's
|
|
42
|
+
embedded and fetched JSON, images, and the receipt.
|
|
43
|
+
|
|
44
|
+
Free or paid
|
|
45
|
+
------------
|
|
46
|
+
|
|
47
|
+
Everything works with no keys. Paid tools are opt-in, and only run after the
|
|
48
|
+
free ones fail. From the benchmark below (152 sites picked before any was read):
|
|
49
|
+
|
|
50
|
+
========================================= ============== =============
|
|
51
|
+
Setup Sites read Cost per 1k
|
|
52
|
+
========================================= ============== =============
|
|
53
|
+
Free tools only (``frankensurf setup``) 73.7% $0
|
|
54
|
+
Plus paid fallbacks (Firecrawl, Zyte, …) 89.5% $0.73
|
|
55
|
+
========================================= ============== =============
|
|
56
|
+
|
|
57
|
+
To allow paid tools, set their keys (for example ``FIRECRAWL_API_KEY``) and pass
|
|
58
|
+
``allow_paid_fallbacks``. See
|
|
59
|
+
`Paid tools and budgets <https://frankensurf.dev/docs/blocked/paid-tools/>`_.
|
|
60
|
+
|
|
61
|
+
Use it
|
|
62
|
+
------
|
|
63
|
+
|
|
64
|
+
From an agent, as an MCP server
|
|
65
|
+
(`setup for each client <https://frankensurf.dev/docs/agents/>`_)::
|
|
66
|
+
|
|
67
|
+
claude mcp add frankensurf -- frankensurf-mcp
|
|
68
|
+
|
|
69
|
+
From Python::
|
|
70
|
+
|
|
71
|
+
from frankensurf import Runtime
|
|
72
|
+
|
|
73
|
+
async with Runtime("state") as web:
|
|
74
|
+
page = await web.read("https://example.com", policy_overrides={"prefer_markdown": True})
|
|
75
|
+
hits = await web.search("playwright python tutorial")
|
|
76
|
+
|
|
77
|
+
From the command line::
|
|
78
|
+
|
|
79
|
+
frankensurf read https://example.com --markdown
|
|
80
|
+
frankensurf search playwright python tutorial
|
|
81
|
+
frankensurf watch https://news.ycombinator.com/ --link-pattern 'item\?id=\d+'
|
|
82
|
+
|
|
83
|
+
What you get back is raw page data, not answers. Your agent decides what the page
|
|
84
|
+
means, and if it isn't what it wanted, it can ask again with
|
|
85
|
+
``retry_of=<trace_id>`` to skip every tool already tried.
|
|
86
|
+
|
|
87
|
+
Also in the box: profiles (log in once, reuse the session from any tool), human
|
|
88
|
+
handoff for CAPTCHAs and 2FA, site modules (save what your agent learns about a
|
|
89
|
+
site as data), and Web Bot Auth request signing.
|
|
90
|
+
|
|
91
|
+
How it works
|
|
92
|
+
------------
|
|
93
|
+
|
|
94
|
+
Every way to fetch a page is a rung: plain HTTP and markdown negotiation,
|
|
95
|
+
browsers, stealth browsers and signed requests, hosted browsers, paid unblockers,
|
|
96
|
+
and finally a person clearing the wall in a visible browser. A read starts at the
|
|
97
|
+
cheapest rung and climbs only when a page pushes back. Every tool is a plugin, so
|
|
98
|
+
new ones slot in as another rung. See
|
|
99
|
+
`How escalation works <https://frankensurf.dev/docs/blocked/escalation/>`_
|
|
100
|
+
and the `full list of integrations <https://frankensurf.dev/docs/integrations/>`_.
|
|
101
|
+
|
|
102
|
+
Benchmark
|
|
103
|
+
---------
|
|
104
|
+
|
|
105
|
+
``scripts/toolbench.py`` runs each tool on its own, then Frankensurf, on the same
|
|
106
|
+
pages with the same content checks. 152 sites picked before any was read, one run
|
|
107
|
+
on 6 October 2026, raw rows in ``benchmarks/2026-10-06/``:
|
|
108
|
+
|
|
109
|
+
========================== ===========
|
|
110
|
+
Tool Sites read
|
|
111
|
+
========================== ===========
|
|
112
|
+
Headless Chromium only 32.2%
|
|
113
|
+
Plain HTTP only 46.1%
|
|
114
|
+
Camoufox only 48.7%
|
|
115
|
+
Scrapling only 53.3%
|
|
116
|
+
ZenRows only 55.3%
|
|
117
|
+
Jina Reader only 63.8%
|
|
118
|
+
Zyte only 73.7%
|
|
119
|
+
Firecrawl only 80.3%
|
|
120
|
+
**Frankensurf** **89.5%**
|
|
121
|
+
========================== ===========
|
|
122
|
+
|
|
123
|
+
Frankensurf read 19 sites Firecrawl missed and Firecrawl read 5 Frankensurf
|
|
124
|
+
missed. Frankensurf costs a fifth as much per page, but is slower: median 9.5 s
|
|
125
|
+
against 5.6 s. Scrapfly is left out because its free plan ran out mid-run. See
|
|
126
|
+
`Benchmarks <https://frankensurf.dev/docs/more/benchmarks/>`_.
|
|
127
|
+
|
|
128
|
+
Known walls
|
|
129
|
+
-----------
|
|
130
|
+
|
|
131
|
+
It's an alpha, and some sites still win:
|
|
132
|
+
|
|
133
|
+
- **Need the paid tools:** in a free-only spot check on 9 October, Etsy, Home
|
|
134
|
+
Depot, Yelp, Crunchbase and G2 blocked every free tool.
|
|
135
|
+
- **Beat everything so far:** Shopee, Temu and Idealista.
|
|
136
|
+
- **Logged-in pages** (your feeds, your orders) need a
|
|
137
|
+
`profile <https://frankensurf.dev/docs/read/profiles/>`_.
|
|
138
|
+
- **Slower than one tool:** a read that climbs several rungs takes 10–30 s.
|
|
139
|
+
|
|
140
|
+
Found a site it can't read?
|
|
141
|
+
`Report it <https://github.com/yail259/frankensurf/issues/new?template=site-it-cant-read.yml>`_;
|
|
142
|
+
every report becomes a test case.
|
|
143
|
+
|
|
144
|
+
Develop
|
|
145
|
+
-------
|
|
146
|
+
|
|
147
|
+
From a clone::
|
|
148
|
+
|
|
149
|
+
python3 -m venv .venv
|
|
150
|
+
.venv/bin/pip install -e '.[test,mcp]'
|
|
151
|
+
.venv/bin/frankensurf setup
|
|
152
|
+
PYTHONPATH=.:src .venv/bin/pytest -q
|
|
153
|
+
|
|
154
|
+
The product design is in ``SPEC.rst``; contributor rules are in ``AGENTS.md``.
|
|
155
|
+
New tools are plugins, never branches in Core; see
|
|
156
|
+
`Writing a plugin <https://frankensurf.dev/docs/more/plugins/>`_. The
|
|
157
|
+
website and docs live in ``site/``.
|
|
158
|
+
|
|
159
|
+
Licence
|
|
160
|
+
-------
|
|
161
|
+
|
|
162
|
+
Apache-2.0. See ``LICENSE``.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "frankensurf"
|
|
7
|
+
version = "0.25.0"
|
|
8
|
+
description = "One read() call for AI agents, stitched from 28 web tools: cheapest first, every page checked, a receipt for every attempt"
|
|
9
|
+
readme = "README.rst"
|
|
10
|
+
license = "Apache-2.0"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
authors = [{ name = "yail259" }]
|
|
13
|
+
requires-python = ">=3.12"
|
|
14
|
+
keywords = ["web scraping", "ai agents", "mcp", "browser automation", "crawler", "playwright", "llm"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Operating System :: POSIX :: Linux",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Programming Language :: Python :: 3.13",
|
|
22
|
+
"Programming Language :: Python :: 3.14",
|
|
23
|
+
"Topic :: Internet :: WWW/HTTP :: Indexing/Search",
|
|
24
|
+
"Topic :: Software Development :: Libraries",
|
|
25
|
+
]
|
|
26
|
+
dependencies = ["httpx>=0.28,<1", "beautifulsoup4>=4.13,<5", "playwright>=1.63,<2", "Pillow>=12,<13", "tiktoken>=0.14,<1", "jsonschema>=4.23,<5", "pypdf>=6,<7", "cryptography>=44"]
|
|
27
|
+
|
|
28
|
+
[project.optional-dependencies]
|
|
29
|
+
test = ["pytest>=9,<10", "pytest-asyncio>=1,<2"]
|
|
30
|
+
mcp = ["mcp>=1.2,<2"]
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
Homepage = "https://frankensurf.dev"
|
|
34
|
+
Documentation = "https://frankensurf.dev/docs/"
|
|
35
|
+
Repository = "https://github.com/yail259/frankensurf"
|
|
36
|
+
Issues = "https://github.com/yail259/frankensurf/issues"
|
|
37
|
+
Changelog = "https://github.com/yail259/frankensurf/releases"
|
|
38
|
+
|
|
39
|
+
[project.scripts]
|
|
40
|
+
frankensurf = "frankensurf.cli:main"
|
|
41
|
+
frankensurf-mcp = "frankensurf.mcp_server:main"
|
|
42
|
+
|
|
43
|
+
[tool.setuptools.packages.find]
|
|
44
|
+
where = ["src"]
|
|
45
|
+
|
|
46
|
+
[tool.setuptools.package-data]
|
|
47
|
+
frankensurf = ["bundled_routes.json", "bundled_route_seeds.json", "provider_requirements.txt"]
|
|
48
|
+
|
|
49
|
+
[tool.pytest.ini_options]
|
|
50
|
+
asyncio_mode = "auto"
|
|
51
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from .runtime import Runtime, WebPolicy
|
|
2
|
+
from .repair import PromotionPolicy, RepairPolicy, WORKLOAD_ASSERTIONS_SCHEMA
|
|
3
|
+
from .actions import ACTION_CLASSES
|
|
4
|
+
from .web_do import (BrowserAction, WebIntent,
|
|
5
|
+
LOCAL_REVERSIBLE_DRAFT_CONTRACT,
|
|
6
|
+
RAW_BROWSER_CONTROL_CONTRACT,
|
|
7
|
+
RAW_CONTROL_REQUIRED_ACTION_CLASSES)
|
|
8
|
+
|
|
9
|
+
__all__ = ["Runtime", "WebPolicy", "ACTION_CLASSES", "BrowserAction",
|
|
10
|
+
"WebIntent", "LOCAL_REVERSIBLE_DRAFT_CONTRACT",
|
|
11
|
+
"RAW_BROWSER_CONTROL_CONTRACT",
|
|
12
|
+
"RAW_CONTROL_REQUIRED_ACTION_CLASSES", "RepairPolicy",
|
|
13
|
+
"PromotionPolicy", "WORKLOAD_ASSERTIONS_SCHEMA"]
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""Operation authority shared by Core, identities, and provider plugins."""
|
|
2
|
+
|
|
3
|
+
ACTION_CLASSES = (
|
|
4
|
+
"READ_PUBLIC",
|
|
5
|
+
"READ_AUTHENTICATED",
|
|
6
|
+
"WRITE_REVERSIBLE",
|
|
7
|
+
"WRITE_EXTERNAL",
|
|
8
|
+
"PURCHASE/FINANCIAL",
|
|
9
|
+
"ACCOUNT_SECURITY",
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
READ_ACTION_CLASSES = frozenset({"READ_PUBLIC", "READ_AUTHENTICATED"})
|
|
13
|
+
WRITE_ACTION_CLASSES = frozenset(ACTION_CLASSES) - READ_ACTION_CLASSES
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def validate_action_classes(value, *, allow_empty=False):
|
|
17
|
+
if (type(value) is not tuple
|
|
18
|
+
or not allow_empty and not value
|
|
19
|
+
or any(item not in ACTION_CLASSES for item in value)
|
|
20
|
+
or len(set(value)) != len(value)):
|
|
21
|
+
raise ValueError(
|
|
22
|
+
"action_classes must be distinct FrankenSurf action classes")
|
|
23
|
+
return value
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def required_read_action(identity):
|
|
27
|
+
return "READ_AUTHENTICATED" if identity else "READ_PUBLIC"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def require_action(policy, action_class):
|
|
31
|
+
"""Reject an operation before acquisition when its class is not granted."""
|
|
32
|
+
from .runtime import WebFailure
|
|
33
|
+
|
|
34
|
+
if action_class not in policy.action_classes:
|
|
35
|
+
raise WebFailure(
|
|
36
|
+
"POLICY_DENIED",
|
|
37
|
+
"Operation action class is not granted by effective policy")
|
|
38
|
+
|