outcrawl 0.1.0__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.
- outcrawl/__init__.py +177 -0
- outcrawl/agent.py +697 -0
- outcrawl/availability.py +198 -0
- outcrawl/client.py +158 -0
- outcrawl/errors.py +1082 -0
- outcrawl/py.typed +0 -0
- outcrawl/registry.py +453 -0
- outcrawl/resources.py +447 -0
- outcrawl/result.py +182 -0
- outcrawl/scrape.py +212 -0
- outcrawl/transport.py +278 -0
- outcrawl-0.1.0.dist-info/METADATA +156 -0
- outcrawl-0.1.0.dist-info/RECORD +15 -0
- outcrawl-0.1.0.dist-info/WHEEL +4 -0
- outcrawl-0.1.0.dist-info/licenses/LICENSE +21 -0
outcrawl/__init__.py
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"""``outcrawl`` — the Python client for Outcrawl.
|
|
2
|
+
|
|
3
|
+
Scrape, crawl, search and run agent tasks against real stealth browsers, on one
|
|
4
|
+
credit balance. Pure Python: one ``py3-none-any`` wheel for every operating
|
|
5
|
+
system, and no compiler on any of them.
|
|
6
|
+
|
|
7
|
+
pip install outcrawl
|
|
8
|
+
|
|
9
|
+
The surface mirrors ``@outcrawl/sdk`` on npm, in Python casing, and the two are
|
|
10
|
+
held to the same contract by the same source of truth: every one of the 34 rows
|
|
11
|
+
in ``packages/core/src/registry.ts`` is reachable from this client, and
|
|
12
|
+
``tests/test_registry.py`` fails when one is not.
|
|
13
|
+
|
|
14
|
+
Errors are the TypeScript SDK's, class for class, field for field, sentence for
|
|
15
|
+
sentence — branch on ``error.code``, never on ``str(error)``.
|
|
16
|
+
|
|
17
|
+
WHAT IS NOT HERE, and it is one thing rather than a missing capability: the live
|
|
18
|
+
browser (``oc.browser()`` in TypeScript). It is deliberately not a registry row
|
|
19
|
+
— it needs a CDP connection driven in the caller's own process — and it reaches
|
|
20
|
+
the same page capabilities through ``agent`` and ``scrape``, which run the loop
|
|
21
|
+
on our side. That is a difference in kind, not an omission.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
from __future__ import annotations
|
|
25
|
+
|
|
26
|
+
from .agent import (
|
|
27
|
+
AGENT_EVENT_LEVELS,
|
|
28
|
+
AGENT_REQUEST_FIELDS,
|
|
29
|
+
AgentApi,
|
|
30
|
+
AgentEvents,
|
|
31
|
+
AgentHandle,
|
|
32
|
+
AgentJob,
|
|
33
|
+
DEFAULT_AGENT_EVENT_LEVEL,
|
|
34
|
+
InvalidAgentRequestError,
|
|
35
|
+
validate_agent_request,
|
|
36
|
+
)
|
|
37
|
+
from .availability import CAPABILITY_AVAILABILITY, Unavailable, assert_available
|
|
38
|
+
from .client import Outcrawl
|
|
39
|
+
from .errors import (
|
|
40
|
+
OUTCRAWL_ERROR_CODES,
|
|
41
|
+
AnswerLostError,
|
|
42
|
+
BadRequestError,
|
|
43
|
+
CapabilityUnavailableError,
|
|
44
|
+
DeadlineExceededError,
|
|
45
|
+
DecodeUnavailableError,
|
|
46
|
+
DocumentUnrepresentableError,
|
|
47
|
+
CapExceededError,
|
|
48
|
+
ConcurrencyLimitError,
|
|
49
|
+
ExitUnavailableError,
|
|
50
|
+
ExtractionFailedError,
|
|
51
|
+
InternalError,
|
|
52
|
+
MethodNotAllowedError,
|
|
53
|
+
NoCapacityError,
|
|
54
|
+
NotFoundError,
|
|
55
|
+
OutcrawlApiError,
|
|
56
|
+
OutcrawlError,
|
|
57
|
+
PageLostError,
|
|
58
|
+
PageUnreachableError,
|
|
59
|
+
PlanRequiredError,
|
|
60
|
+
ProfileInUseError,
|
|
61
|
+
ProfileNotFoundError,
|
|
62
|
+
QuotaExceededError,
|
|
63
|
+
TenantScopeError,
|
|
64
|
+
UnauthorizedError,
|
|
65
|
+
error_from_wire,
|
|
66
|
+
is_known_error_code,
|
|
67
|
+
is_outcrawl_error,
|
|
68
|
+
)
|
|
69
|
+
from .registry import (
|
|
70
|
+
CAPABILITIES,
|
|
71
|
+
CAPABILITY_NAMES,
|
|
72
|
+
CLI_CAPABILITIES,
|
|
73
|
+
MCP_CAPABILITIES,
|
|
74
|
+
Capability,
|
|
75
|
+
get_capability,
|
|
76
|
+
)
|
|
77
|
+
from .resources import (
|
|
78
|
+
IdentityOverrideError,
|
|
79
|
+
Integrations,
|
|
80
|
+
Monitors,
|
|
81
|
+
Profiles,
|
|
82
|
+
Rules,
|
|
83
|
+
Secrets,
|
|
84
|
+
Session,
|
|
85
|
+
Sessions,
|
|
86
|
+
UnsupportedSessionFilterError,
|
|
87
|
+
)
|
|
88
|
+
from .result import Deleted, Paged, Result
|
|
89
|
+
from .scrape import CrawlApi, CrawlHandle, CrawlJob
|
|
90
|
+
from .transport import (
|
|
91
|
+
API_KEY_ENV,
|
|
92
|
+
API_URL_ENV,
|
|
93
|
+
DEFAULT_BASE_URL,
|
|
94
|
+
HttpTransport,
|
|
95
|
+
RequestSpec,
|
|
96
|
+
Transport,
|
|
97
|
+
always_streams,
|
|
98
|
+
resolve_request,
|
|
99
|
+
stream_switch,
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
__version__ = "0.1.0"
|
|
103
|
+
|
|
104
|
+
__all__ = [
|
|
105
|
+
"AGENT_EVENT_LEVELS",
|
|
106
|
+
"AGENT_REQUEST_FIELDS",
|
|
107
|
+
"API_KEY_ENV",
|
|
108
|
+
"API_URL_ENV",
|
|
109
|
+
"AgentApi",
|
|
110
|
+
"AgentEvents",
|
|
111
|
+
"AgentHandle",
|
|
112
|
+
"AgentJob",
|
|
113
|
+
"AnswerLostError",
|
|
114
|
+
"BadRequestError",
|
|
115
|
+
"CAPABILITIES",
|
|
116
|
+
"CAPABILITY_AVAILABILITY",
|
|
117
|
+
"CAPABILITY_NAMES",
|
|
118
|
+
"CLI_CAPABILITIES",
|
|
119
|
+
"Capability",
|
|
120
|
+
"CapExceededError",
|
|
121
|
+
"CapabilityUnavailableError",
|
|
122
|
+
"DeadlineExceededError",
|
|
123
|
+
"DecodeUnavailableError",
|
|
124
|
+
"DocumentUnrepresentableError",
|
|
125
|
+
"ConcurrencyLimitError",
|
|
126
|
+
"CrawlApi",
|
|
127
|
+
"CrawlHandle",
|
|
128
|
+
"CrawlJob",
|
|
129
|
+
"DEFAULT_AGENT_EVENT_LEVEL",
|
|
130
|
+
"DEFAULT_BASE_URL",
|
|
131
|
+
"Deleted",
|
|
132
|
+
"ExitUnavailableError",
|
|
133
|
+
"ExtractionFailedError",
|
|
134
|
+
"HttpTransport",
|
|
135
|
+
"IdentityOverrideError",
|
|
136
|
+
"Integrations",
|
|
137
|
+
"InternalError",
|
|
138
|
+
"InvalidAgentRequestError",
|
|
139
|
+
"MCP_CAPABILITIES",
|
|
140
|
+
"MethodNotAllowedError",
|
|
141
|
+
"Monitors",
|
|
142
|
+
"NoCapacityError",
|
|
143
|
+
"NotFoundError",
|
|
144
|
+
"OUTCRAWL_ERROR_CODES",
|
|
145
|
+
"Outcrawl",
|
|
146
|
+
"OutcrawlApiError",
|
|
147
|
+
"OutcrawlError",
|
|
148
|
+
"Paged",
|
|
149
|
+
"PageLostError",
|
|
150
|
+
"PageUnreachableError",
|
|
151
|
+
"PlanRequiredError",
|
|
152
|
+
"Profiles",
|
|
153
|
+
"ProfileInUseError",
|
|
154
|
+
"ProfileNotFoundError",
|
|
155
|
+
"QuotaExceededError",
|
|
156
|
+
"RequestSpec",
|
|
157
|
+
"Result",
|
|
158
|
+
"Rules",
|
|
159
|
+
"Secrets",
|
|
160
|
+
"Session",
|
|
161
|
+
"Sessions",
|
|
162
|
+
"TenantScopeError",
|
|
163
|
+
"Transport",
|
|
164
|
+
"UnauthorizedError",
|
|
165
|
+
"Unavailable",
|
|
166
|
+
"UnsupportedSessionFilterError",
|
|
167
|
+
"__version__",
|
|
168
|
+
"always_streams",
|
|
169
|
+
"assert_available",
|
|
170
|
+
"error_from_wire",
|
|
171
|
+
"get_capability",
|
|
172
|
+
"is_known_error_code",
|
|
173
|
+
"is_outcrawl_error",
|
|
174
|
+
"resolve_request",
|
|
175
|
+
"stream_switch",
|
|
176
|
+
"validate_agent_request",
|
|
177
|
+
]
|