ghostcrawl 2.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.
Files changed (140) hide show
  1. ghostcrawl/__init__.py +271 -0
  2. ghostcrawl/_default_clients.py +30 -0
  3. ghostcrawl/_ghostcrawl.py +418 -0
  4. ghostcrawl/audit/__init__.py +34 -0
  5. ghostcrawl/audit/client.py +194 -0
  6. ghostcrawl/audit/raw_client.py +218 -0
  7. ghostcrawl/audit/types/__init__.py +34 -0
  8. ghostcrawl/audit/types/list_events_audit_request_outcome.py +5 -0
  9. ghostcrawl/auth/__init__.py +4 -0
  10. ghostcrawl/auth/client.py +569 -0
  11. ghostcrawl/auth/raw_client.py +846 -0
  12. ghostcrawl/auth_tokens/__init__.py +4 -0
  13. ghostcrawl/auth_tokens/client.py +267 -0
  14. ghostcrawl/auth_tokens/raw_client.py +339 -0
  15. ghostcrawl/branded.py +177 -0
  16. ghostcrawl/budgets/__init__.py +4 -0
  17. ghostcrawl/budgets/client.py +490 -0
  18. ghostcrawl/budgets/raw_client.py +630 -0
  19. ghostcrawl/cli/__init__.py +17 -0
  20. ghostcrawl/cli/_batch.py +240 -0
  21. ghostcrawl/cli/_config_store.py +60 -0
  22. ghostcrawl/cli/_fern_raw.py +35 -0
  23. ghostcrawl/cli/install.py +103 -0
  24. ghostcrawl/cli/main.py +897 -0
  25. ghostcrawl/client.py +765 -0
  26. ghostcrawl/core/__init__.py +127 -0
  27. ghostcrawl/core/api_error.py +23 -0
  28. ghostcrawl/core/client_wrapper.py +101 -0
  29. ghostcrawl/core/datetime_utils.py +70 -0
  30. ghostcrawl/core/file.py +67 -0
  31. ghostcrawl/core/force_multipart.py +18 -0
  32. ghostcrawl/core/http_client.py +839 -0
  33. ghostcrawl/core/http_response.py +59 -0
  34. ghostcrawl/core/http_sse/__init__.py +42 -0
  35. ghostcrawl/core/http_sse/_api.py +148 -0
  36. ghostcrawl/core/http_sse/_decoders.py +61 -0
  37. ghostcrawl/core/http_sse/_exceptions.py +7 -0
  38. ghostcrawl/core/http_sse/_models.py +17 -0
  39. ghostcrawl/core/jsonable_encoder.py +120 -0
  40. ghostcrawl/core/logging.py +107 -0
  41. ghostcrawl/core/parse_error.py +36 -0
  42. ghostcrawl/core/pydantic_utilities.py +634 -0
  43. ghostcrawl/core/query_encoder.py +58 -0
  44. ghostcrawl/core/remove_none_from_dict.py +11 -0
  45. ghostcrawl/core/request_options.py +35 -0
  46. ghostcrawl/core/serialization.py +276 -0
  47. ghostcrawl/crawl_runs/__init__.py +4 -0
  48. ghostcrawl/crawl_runs/client.py +437 -0
  49. ghostcrawl/crawl_runs/raw_client.py +638 -0
  50. ghostcrawl/datasets/__init__.py +4 -0
  51. ghostcrawl/datasets/client.py +509 -0
  52. ghostcrawl/datasets/raw_client.py +712 -0
  53. ghostcrawl/errors/__init__.py +34 -0
  54. ghostcrawl/errors/identity_errors.py +133 -0
  55. ghostcrawl/errors/unprocessable_entity_error.py +11 -0
  56. ghostcrawl/identity/__init__.py +17 -0
  57. ghostcrawl/identity/client.py +195 -0
  58. ghostcrawl/identity/types.py +58 -0
  59. ghostcrawl/management/__init__.py +4 -0
  60. ghostcrawl/management/client.py +108 -0
  61. ghostcrawl/management/raw_client.py +109 -0
  62. ghostcrawl/mcp/__init__.py +25 -0
  63. ghostcrawl/mcp/wrapper.py +353 -0
  64. ghostcrawl/mfa/__init__.py +4 -0
  65. ghostcrawl/mfa/client.py +394 -0
  66. ghostcrawl/mfa/raw_client.py +587 -0
  67. ghostcrawl/oauth/__init__.py +4 -0
  68. ghostcrawl/oauth/client.py +764 -0
  69. ghostcrawl/oauth/raw_client.py +1123 -0
  70. ghostcrawl/observability/__init__.py +4 -0
  71. ghostcrawl/observability/client.py +198 -0
  72. ghostcrawl/observability/raw_client.py +293 -0
  73. ghostcrawl/page/__init__.py +34 -0
  74. ghostcrawl/page/client.py +816 -0
  75. ghostcrawl/page/raw_client.py +1176 -0
  76. ghostcrawl/page/types/__init__.py +34 -0
  77. ghostcrawl/page/types/scroll_body_direction.py +5 -0
  78. ghostcrawl/params.py +38 -0
  79. ghostcrawl/profiles/__init__.py +4 -0
  80. ghostcrawl/profiles/client.py +172 -0
  81. ghostcrawl/profiles/raw_client.py +200 -0
  82. ghostcrawl/py.typed +0 -0
  83. ghostcrawl/raw_client.py +357 -0
  84. ghostcrawl/recordings/__init__.py +4 -0
  85. ghostcrawl/recordings/client.py +546 -0
  86. ghostcrawl/recordings/raw_client.py +767 -0
  87. ghostcrawl/retry_policy.py +71 -0
  88. ghostcrawl/screenshot_blobs/__init__.py +4 -0
  89. ghostcrawl/screenshot_blobs/client.py +125 -0
  90. ghostcrawl/screenshot_blobs/raw_client.py +151 -0
  91. ghostcrawl/script/__init__.py +4 -0
  92. ghostcrawl/script/client.py +124 -0
  93. ghostcrawl/script/raw_client.py +157 -0
  94. ghostcrawl/sessions/__init__.py +4 -0
  95. ghostcrawl/sessions/client.py +278 -0
  96. ghostcrawl/sessions/raw_client.py +347 -0
  97. ghostcrawl/storage_states/__init__.py +4 -0
  98. ghostcrawl/storage_states/client.py +536 -0
  99. ghostcrawl/storage_states/raw_client.py +810 -0
  100. ghostcrawl/types/__init__.py +128 -0
  101. ghostcrawl/types/audit_event_out.py +28 -0
  102. ghostcrawl/types/audit_events_response.py +14 -0
  103. ghostcrawl/types/cookie_dict.py +29 -0
  104. ghostcrawl/types/cookie_dict_same_site.py +5 -0
  105. ghostcrawl/types/device_auth_envelope.py +17 -0
  106. ghostcrawl/types/device_poll_request.py +12 -0
  107. ghostcrawl/types/enroll_response.py +15 -0
  108. ghostcrawl/types/http_validation_error.py +13 -0
  109. ghostcrawl/types/link_confirm_response.py +16 -0
  110. ghostcrawl/types/link_decline_response.py +13 -0
  111. ghostcrawl/types/password_reset_confirm_response.py +12 -0
  112. ghostcrawl/types/password_reset_request_response.py +12 -0
  113. ghostcrawl/types/regenerate_response.py +12 -0
  114. ghostcrawl/types/resend_response.py +12 -0
  115. ghostcrawl/types/retry_delivery_response.py +23 -0
  116. ghostcrawl/types/rotate_secret_response.py +32 -0
  117. ghostcrawl/types/signup_response.py +13 -0
  118. ghostcrawl/types/token_create_response.py +22 -0
  119. ghostcrawl/types/token_list_item.py +24 -0
  120. ghostcrawl/types/token_list_response.py +17 -0
  121. ghostcrawl/types/unlink_response.py +13 -0
  122. ghostcrawl/types/user_shape.py +14 -0
  123. ghostcrawl/types/validation_error.py +17 -0
  124. ghostcrawl/types/validation_error_loc_item.py +5 -0
  125. ghostcrawl/types/verify_response.py +12 -0
  126. ghostcrawl/types/webhook_create_response.py +25 -0
  127. ghostcrawl/types/webhook_delivery_list_response.py +19 -0
  128. ghostcrawl/types/webhook_delivery_public.py +32 -0
  129. ghostcrawl/types/webhook_list_response.py +19 -0
  130. ghostcrawl/types/webhook_public.py +29 -0
  131. ghostcrawl/types/webhooks_queue_response.py +27 -0
  132. ghostcrawl/webhooks/__init__.py +4 -0
  133. ghostcrawl/webhooks/client.py +743 -0
  134. ghostcrawl/webhooks/raw_client.py +966 -0
  135. ghostcrawl-2.1.0.dist-info/METADATA +211 -0
  136. ghostcrawl-2.1.0.dist-info/RECORD +140 -0
  137. ghostcrawl-2.1.0.dist-info/WHEEL +5 -0
  138. ghostcrawl-2.1.0.dist-info/entry_points.txt +2 -0
  139. ghostcrawl-2.1.0.dist-info/licenses/LICENSE +201 -0
  140. ghostcrawl-2.1.0.dist-info/top_level.txt +1 -0
ghostcrawl/__init__.py ADDED
@@ -0,0 +1,271 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ import typing
6
+ from importlib import import_module
7
+
8
+ if typing.TYPE_CHECKING:
9
+ from .types import (
10
+ AuditEventOut,
11
+ AuditEventsResponse,
12
+ CookieDict,
13
+ CookieDictSameSite,
14
+ DeviceAuthEnvelope,
15
+ DevicePollRequest,
16
+ EnrollResponse,
17
+ HttpValidationError,
18
+ LinkConfirmResponse,
19
+ LinkDeclineResponse,
20
+ PasswordResetConfirmResponse,
21
+ PasswordResetRequestResponse,
22
+ RegenerateResponse,
23
+ ResendResponse,
24
+ RetryDeliveryResponse,
25
+ RotateSecretResponse,
26
+ SignupResponse,
27
+ TokenCreateResponse,
28
+ TokenListItem,
29
+ TokenListResponse,
30
+ UnlinkResponse,
31
+ UserShape,
32
+ ValidationError,
33
+ ValidationErrorLocItem,
34
+ VerifyResponse,
35
+ WebhookCreateResponse,
36
+ WebhookDeliveryListResponse,
37
+ WebhookDeliveryPublic,
38
+ WebhookListResponse,
39
+ WebhookPublic,
40
+ WebhooksQueueResponse,
41
+ )
42
+ from .errors import UnprocessableEntityError
43
+ from . import (
44
+ audit,
45
+ auth,
46
+ auth_tokens,
47
+ budgets,
48
+ crawl_runs,
49
+ datasets,
50
+ management,
51
+ mfa,
52
+ oauth,
53
+ observability,
54
+ page,
55
+ profiles,
56
+ recordings,
57
+ screenshot_blobs,
58
+ script,
59
+ sessions,
60
+ storage_states,
61
+ webhooks,
62
+ )
63
+ from ._default_clients import DefaultAioHttpClient, DefaultAsyncHttpxClient
64
+ from .audit import ListEventsAuditRequestOutcome
65
+ from .client import AsyncGhostcrawlClient, GhostcrawlClient
66
+ from .page import ScrollBodyDirection
67
+ _dynamic_imports: typing.Dict[str, str] = {
68
+ "AsyncGhostcrawlClient": ".client",
69
+ "AuditEventOut": ".types",
70
+ "AuditEventsResponse": ".types",
71
+ "CookieDict": ".types",
72
+ "CookieDictSameSite": ".types",
73
+ "DefaultAioHttpClient": "._default_clients",
74
+ "DefaultAsyncHttpxClient": "._default_clients",
75
+ "DeviceAuthEnvelope": ".types",
76
+ "DevicePollRequest": ".types",
77
+ "EnrollResponse": ".types",
78
+ "GhostcrawlClient": ".client",
79
+ "HttpValidationError": ".types",
80
+ "LinkConfirmResponse": ".types",
81
+ "LinkDeclineResponse": ".types",
82
+ "ListEventsAuditRequestOutcome": ".audit",
83
+ "PasswordResetConfirmResponse": ".types",
84
+ "PasswordResetRequestResponse": ".types",
85
+ "RegenerateResponse": ".types",
86
+ "ResendResponse": ".types",
87
+ "RetryDeliveryResponse": ".types",
88
+ "RotateSecretResponse": ".types",
89
+ "ScrollBodyDirection": ".page",
90
+ "SignupResponse": ".types",
91
+ "TokenCreateResponse": ".types",
92
+ "TokenListItem": ".types",
93
+ "TokenListResponse": ".types",
94
+ "UnlinkResponse": ".types",
95
+ "UnprocessableEntityError": ".errors",
96
+ "UserShape": ".types",
97
+ "ValidationError": ".types",
98
+ "ValidationErrorLocItem": ".types",
99
+ "VerifyResponse": ".types",
100
+ "WebhookCreateResponse": ".types",
101
+ "WebhookDeliveryListResponse": ".types",
102
+ "WebhookDeliveryPublic": ".types",
103
+ "WebhookListResponse": ".types",
104
+ "WebhookPublic": ".types",
105
+ "WebhooksQueueResponse": ".types",
106
+ "audit": ".audit",
107
+ "auth": ".auth",
108
+ "auth_tokens": ".auth_tokens",
109
+ "budgets": ".budgets",
110
+ "crawl_runs": ".crawl_runs",
111
+ "datasets": ".datasets",
112
+ "management": ".management",
113
+ "mfa": ".mfa",
114
+ "oauth": ".oauth",
115
+ "observability": ".observability",
116
+ "page": ".page",
117
+ "profiles": ".profiles",
118
+ "recordings": ".recordings",
119
+ "screenshot_blobs": ".screenshot_blobs",
120
+ "script": ".script",
121
+ "sessions": ".sessions",
122
+ "storage_states": ".storage_states",
123
+ "webhooks": ".webhooks",
124
+ # --- Phase 140.4-24 — hand-written surface from ._ghostcrawl ---------------
125
+ # These are eagerly imported at the bottom of this module via
126
+ # `from ._ghostcrawl import ...`. Registering them in `_dynamic_imports`
127
+ # makes them visible to `__dir__()` and documents the canonical lazy-import
128
+ # path that Fern's regeneration is expected to preserve (sdk-f013, sdk-f014).
129
+ "Ghostcrawl": "._ghostcrawl",
130
+ "identity": "._ghostcrawl",
131
+ "Client": "._ghostcrawl",
132
+ "GhostcrawlError": "._ghostcrawl",
133
+ "AuthenticationError": "._ghostcrawl",
134
+ "InvalidRequestError": "._ghostcrawl",
135
+ "APIError": "._ghostcrawl",
136
+ "ProviderConfigError": "._ghostcrawl",
137
+ }
138
+
139
+
140
+ def __getattr__(attr_name: str) -> typing.Any:
141
+ module_name = _dynamic_imports.get(attr_name)
142
+ if module_name is None:
143
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
144
+ try:
145
+ module = import_module(module_name, __package__)
146
+ if module_name == f".{attr_name}":
147
+ return module
148
+ else:
149
+ return getattr(module, attr_name)
150
+ except ImportError as e:
151
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
152
+ except AttributeError as e:
153
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
154
+
155
+
156
+ def __dir__():
157
+ lazy_attrs = list(_dynamic_imports.keys())
158
+ return sorted(lazy_attrs)
159
+
160
+
161
+ __all__ = [
162
+ "AsyncGhostcrawlClient",
163
+ "AuditEventOut",
164
+ "AuditEventsResponse",
165
+ "CookieDict",
166
+ "CookieDictSameSite",
167
+ "DefaultAioHttpClient",
168
+ "DefaultAsyncHttpxClient",
169
+ "DeviceAuthEnvelope",
170
+ "DevicePollRequest",
171
+ "EnrollResponse",
172
+ "GhostcrawlClient",
173
+ "HttpValidationError",
174
+ "LinkConfirmResponse",
175
+ "LinkDeclineResponse",
176
+ "ListEventsAuditRequestOutcome",
177
+ "PasswordResetConfirmResponse",
178
+ "PasswordResetRequestResponse",
179
+ "RegenerateResponse",
180
+ "ResendResponse",
181
+ "RetryDeliveryResponse",
182
+ "RotateSecretResponse",
183
+ "ScrollBodyDirection",
184
+ "SignupResponse",
185
+ "TokenCreateResponse",
186
+ "TokenListItem",
187
+ "TokenListResponse",
188
+ "UnlinkResponse",
189
+ "UnprocessableEntityError",
190
+ "UserShape",
191
+ "ValidationError",
192
+ "ValidationErrorLocItem",
193
+ "VerifyResponse",
194
+ "WebhookCreateResponse",
195
+ "WebhookDeliveryListResponse",
196
+ "WebhookDeliveryPublic",
197
+ "WebhookListResponse",
198
+ "WebhookPublic",
199
+ "WebhooksQueueResponse",
200
+ "audit",
201
+ "auth",
202
+ "auth_tokens",
203
+ "budgets",
204
+ "crawl_runs",
205
+ "datasets",
206
+ "management",
207
+ "mfa",
208
+ "oauth",
209
+ "observability",
210
+ "page",
211
+ "profiles",
212
+ "recordings",
213
+ "screenshot_blobs",
214
+ "script",
215
+ "sessions",
216
+ "storage_states",
217
+ "webhooks",
218
+ # --- Phase 117 additions (NOT Fern-generated) ---
219
+ "Ghostcrawl",
220
+ "identity",
221
+ "GhostcrawlError",
222
+ "AuthenticationError",
223
+ "InvalidRequestError",
224
+ "APIError",
225
+ "ProviderConfigError",
226
+ ]
227
+
228
+
229
+ # =============================================================================
230
+ # Phase 117 — SaaS public SDK surface
231
+ # =============================================================================
232
+ # NOTE: This section is hand-written and is NOT generated by Fern.
233
+ # Future Fern regeneration will only touch the section above.
234
+ # Fern regeneration is safe because this block is appended after __all__ and
235
+ # uses only absolute imports within the same package.
236
+ #
237
+ # Phase 140.4-24 (sdk-f001/013/014): the 322-line `Ghostcrawl` class + the
238
+ # functional `identity` wrapper + the `Client` alias + the error re-exports
239
+ # now live in `_ghostcrawl.py`. Keeping them out of this Fern-managed file
240
+ # means `fern generate` cannot clobber them. The re-export below is the
241
+ # canonical surface; do NOT inline the class back here.
242
+ # =============================================================================
243
+
244
+ import typing as _typing # noqa: F401 — kept for downstream re-export hygiene
245
+ import os as _os # noqa: F401
246
+
247
+ from ._ghostcrawl import (
248
+ Ghostcrawl,
249
+ identity,
250
+ Client,
251
+ GhostcrawlError,
252
+ AuthenticationError,
253
+ InvalidRequestError,
254
+ APIError,
255
+ ProviderConfigError,
256
+ )
257
+
258
+
259
+
260
+ # =============================================================================
261
+ # Phase 140.2 Wave 2 — SDK ergonomic extensions (SDK-PY-01/02/03)
262
+ # =============================================================================
263
+ # NOTE: Hand-written. Not Fern-generated. Future fern generate will not touch
264
+ # this block (it is appended after the generated __all__ + Phase 117 section).
265
+ # =============================================================================
266
+
267
+ from .params import encode_js_snippet, format_cookies, format_cookies_urlencoded, build_extract_rules, build_js_scenario
268
+ from .retry_policy import RetryPolicy, with_retries
269
+ from .branded import branded_client, _ua_string as _ghostcrawl_ua_string
270
+
271
+
@@ -0,0 +1,30 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import httpx
6
+
7
+ SDK_DEFAULT_TIMEOUT = 60
8
+
9
+ try:
10
+ import httpx_aiohttp # type: ignore[import-not-found]
11
+ except ImportError:
12
+
13
+ class DefaultAioHttpClient(httpx.AsyncClient): # type: ignore
14
+ def __init__(self, **kwargs: typing.Any) -> None:
15
+ raise RuntimeError("To use the aiohttp client, install the aiohttp extra: pip install package[aiohttp]")
16
+
17
+ else:
18
+
19
+ class DefaultAioHttpClient(httpx_aiohttp.HttpxAiohttpClient): # type: ignore
20
+ def __init__(self, **kwargs: typing.Any) -> None:
21
+ kwargs.setdefault("timeout", SDK_DEFAULT_TIMEOUT)
22
+ kwargs.setdefault("follow_redirects", True)
23
+ super().__init__(**kwargs)
24
+
25
+
26
+ class DefaultAsyncHttpxClient(httpx.AsyncClient):
27
+ def __init__(self, **kwargs: typing.Any) -> None:
28
+ kwargs.setdefault("timeout", SDK_DEFAULT_TIMEOUT)
29
+ kwargs.setdefault("follow_redirects", True)
30
+ super().__init__(**kwargs)