raspbytes 1.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 (39) hide show
  1. raspbytes/__init__.py +87 -0
  2. raspbytes/_core/__init__.py +1 -0
  3. raspbytes/_core/constants.py +38 -0
  4. raspbytes/_core/http.py +160 -0
  5. raspbytes/_core/transport.py +175 -0
  6. raspbytes/_core/types.py +11 -0
  7. raspbytes/_core/version.py +8 -0
  8. raspbytes/client.py +88 -0
  9. raspbytes/config.py +122 -0
  10. raspbytes/countries.py +278 -0
  11. raspbytes/exceptions.py +115 -0
  12. raspbytes/managed_scrapers.py +4 -0
  13. raspbytes/models.py +89 -0
  14. raspbytes/py.typed +1 -0
  15. raspbytes/resources/__init__.py +17 -0
  16. raspbytes/resources/_base.py +75 -0
  17. raspbytes/resources/_polling.py +73 -0
  18. raspbytes/resources/browser.py +185 -0
  19. raspbytes/resources/proxies.py +49 -0
  20. raspbytes/resources/scraper/__init__.py +45 -0
  21. raspbytes/resources/scraper/_generated/__init__.py +1 -0
  22. raspbytes/resources/scraper/_generated/managed.py +190 -0
  23. raspbytes/resources/scraper/_generated/wire.py +632 -0
  24. raspbytes/resources/scraper/_managed.py +14 -0
  25. raspbytes/resources/scraper/_request.py +128 -0
  26. raspbytes/resources/scraper/builder.py +199 -0
  27. raspbytes/resources/scraper/hub.py +168 -0
  28. raspbytes/resources/scraper/monitoring.py +132 -0
  29. raspbytes/resources/scraper/runs.py +202 -0
  30. raspbytes/resources/scraper/schedules.py +172 -0
  31. raspbytes/resources/scraper/storage.py +155 -0
  32. raspbytes/resources/scraper/tasks.py +134 -0
  33. raspbytes/resources/scraper/types.py +96 -0
  34. raspbytes/resources/unblocker.py +131 -0
  35. raspbytes/scraper_types.py +4 -0
  36. raspbytes-1.1.0.dist-info/METADATA +297 -0
  37. raspbytes-1.1.0.dist-info/RECORD +39 -0
  38. raspbytes-1.1.0.dist-info/WHEEL +4 -0
  39. raspbytes-1.1.0.dist-info/licenses/LICENSE +25 -0
@@ -0,0 +1,96 @@
1
+ """Public request and response types for Scraper management resources.
2
+
3
+ Use these TypedDicts to annotate payloads and results. They are ordinary dictionaries
4
+ at runtime, with field names matching the Raspbytes API.
5
+ """
6
+
7
+ from typing import Literal
8
+
9
+ from ._generated.wire import CreatorScraperCreate as CreateOwnedScraperParams
10
+ from ._generated.wire import CreatorScraperResponse as OwnedScraper
11
+ from ._generated.wire import CreatorScraperRevisionCreate as CreateOwnedScraperRevisionParams
12
+ from ._generated.wire import CreatorScraperRevisionResponse as OwnedScraperRevision
13
+ from ._generated.wire import CreatorScraperShareCreate as ShareOwnedScraperParams
14
+ from ._generated.wire import CreatorScraperShareResponse as OwnedScraperShare
15
+ from ._generated.wire import OverlapPolicyEnum as ScheduleOverlapPolicy
16
+ from ._generated.wire import PatchedCreatorScraperUpdate as UpdateOwnedScraperParams
17
+ from ._generated.wire import PatchedScraperMonitorPolicyUpdate as UpdateScraperMonitorPolicyParams
18
+ from ._generated.wire import PatchedScraperScheduleUpdate as UpdateScraperScheduleParams
19
+ from ._generated.wire import PatchedScrapingTaskUpdate as UpdateScrapingTaskParams
20
+ from ._generated.wire import RecurringScheduleFrequencyEnum as ScheduleFrequency
21
+ from ._generated.wire import (
22
+ SavedScraperDefinition,
23
+ SavedScraperInputOption,
24
+ SavedScraperInputParameter,
25
+ SavedScraperInputSchema,
26
+ ScraperHubRun,
27
+ ScraperHubRunConfiguration,
28
+ ScraperScheduleRequestOverrides,
29
+ ScrapingTaskConfiguration,
30
+ )
31
+ from ._generated.wire import ScrapeJobPage as ScraperRunPage
32
+ from ._generated.wire import ScrapeJobResponse as ScraperRun
33
+ from ._generated.wire import ScraperArtifactDownload as ScraperDownloadLink
34
+ from ._generated.wire import ScraperArtifactResponse as ScraperArtifact
35
+ from ._generated.wire import ScrapeRequest as ScraperRequest
36
+ from ._generated.wire import ScraperHubItemResponse as ScraperHubItem
37
+ from ._generated.wire import ScraperHubResponse as ScraperHubPage
38
+ from ._generated.wire import ScraperMonitoringResponse as ScraperMonitoring
39
+ from ._generated.wire import ScraperMonitoringScopePage as ScraperMonitoringScopes
40
+ from ._generated.wire import ScraperMonitoringScopeTypeEnum as ScraperMonitoringScopeType
41
+ from ._generated.wire import ScraperMonitorPolicyResponse as ScraperMonitorPolicy
42
+ from ._generated.wire import ScraperScheduleCreate as CreateScraperScheduleParams
43
+ from ._generated.wire import ScraperScheduleResponse as ScraperSchedule
44
+ from ._generated.wire import ScraperStorageArtifactPage as ScraperArtifactPage
45
+ from ._generated.wire import ScraperStorageArtifactResponse as ScraperStorageArtifact
46
+ from ._generated.wire import ScrapingTaskCreate as CreateScrapingTaskParams
47
+ from ._generated.wire import ScrapingTaskResponse as ScrapingTask
48
+ from ._generated.wire import ScrapingTaskRun as RunScrapingTaskParams
49
+ from ._generated.wire import ScrapingTaskVersionCreate as CreateScrapingTaskRevisionParams
50
+ from ._generated.wire import ScrapingTaskVersionResponse as ScrapingTaskRevision
51
+
52
+ ScraperMonitoringWindow = Literal["1h", "6h", "24h", "7d", "30d"]
53
+
54
+ __all__ = [
55
+ "CreateOwnedScraperParams",
56
+ "CreateOwnedScraperRevisionParams",
57
+ "CreateScraperScheduleParams",
58
+ "CreateScrapingTaskParams",
59
+ "CreateScrapingTaskRevisionParams",
60
+ "OwnedScraper",
61
+ "OwnedScraperRevision",
62
+ "OwnedScraperShare",
63
+ "RunScrapingTaskParams",
64
+ "SavedScraperDefinition",
65
+ "SavedScraperInputOption",
66
+ "SavedScraperInputParameter",
67
+ "SavedScraperInputSchema",
68
+ "ScheduleFrequency",
69
+ "ScheduleOverlapPolicy",
70
+ "ScraperArtifact",
71
+ "ScraperArtifactPage",
72
+ "ScraperDownloadLink",
73
+ "ScraperHubItem",
74
+ "ScraperHubPage",
75
+ "ScraperHubRun",
76
+ "ScraperHubRunConfiguration",
77
+ "ScraperMonitorPolicy",
78
+ "ScraperMonitoring",
79
+ "ScraperMonitoringScopeType",
80
+ "ScraperMonitoringScopes",
81
+ "ScraperMonitoringWindow",
82
+ "ScraperRequest",
83
+ "ScraperRun",
84
+ "ScraperRunPage",
85
+ "ScraperSchedule",
86
+ "ScraperScheduleRequestOverrides",
87
+ "ScraperStorageArtifact",
88
+ "ScrapingTask",
89
+ "ScrapingTaskConfiguration",
90
+ "ScrapingTaskRevision",
91
+ "ShareOwnedScraperParams",
92
+ "UpdateOwnedScraperParams",
93
+ "UpdateScraperMonitorPolicyParams",
94
+ "UpdateScraperScheduleParams",
95
+ "UpdateScrapingTaskParams",
96
+ ]
@@ -0,0 +1,131 @@
1
+ """Web Unblocker API resources."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from collections.abc import Mapping
6
+ from typing import Any
7
+
8
+ from .._core.constants import RequestField, ResponseField
9
+ from .._core.transport import AsyncTransport, SyncTransport
10
+ from .._core.types import ResponseData
11
+ from ..config import UnblockerConfig
12
+ from ..models import UnblockRequest
13
+ from ._base import AsyncResource, SyncResource, prepare_payload
14
+ from ._polling import ObjectResponse, poll, poll_async
15
+
16
+ _COMPLETED_STATUS = "completed"
17
+ _FAILED_STATES = frozenset({"failed", "cancelled", "canceled", "expired"})
18
+
19
+
20
+ class _Routes:
21
+ RETRIEVE = "unblock/"
22
+ ENTITLEMENT = "unblock/entitlement/"
23
+ REQUESTS = "unblock/requests/"
24
+
25
+ @staticmethod
26
+ def request(request_id: str) -> str:
27
+ return f"{_Routes.REQUESTS}{request_id}/"
28
+
29
+
30
+ def _is_completed(resource: ObjectResponse) -> bool:
31
+ return resource.get(ResponseField.STATUS) == _COMPLETED_STATUS
32
+
33
+
34
+ class UnblockerResource(SyncResource):
35
+ def __init__(self, transport: SyncTransport, config: UnblockerConfig | None = None) -> None:
36
+ self._config = config or UnblockerConfig()
37
+ super().__init__(transport, self._config)
38
+
39
+ def retrieve(
40
+ self, request: UnblockRequest | Mapping[str, Any] | None = None, **fields: Any
41
+ ) -> ResponseData:
42
+ return self._post(_Routes.RETRIEVE, json=prepare_payload(request, fields))
43
+
44
+ def entitlement(self) -> ResponseData:
45
+ return self._get(_Routes.ENTITLEMENT)
46
+
47
+ def list_requests(
48
+ self, *, page: int | None = None, page_size: int | None = None, **filters: Any
49
+ ) -> ResponseData:
50
+ return self._get(
51
+ _Routes.REQUESTS,
52
+ params={RequestField.PAGE: page, RequestField.PAGE_SIZE: page_size, **filters},
53
+ )
54
+
55
+ def create_request(
56
+ self, request: UnblockRequest | Mapping[str, Any] | None = None, **fields: Any
57
+ ) -> ResponseData:
58
+ return self._post(_Routes.REQUESTS, json=prepare_payload(request, fields))
59
+
60
+ def get_request(self, request_id: str) -> ResponseData:
61
+ return self._get(_Routes.request(request_id))
62
+
63
+ def cancel_request(self, request_id: str) -> ResponseData:
64
+ return self._delete(_Routes.request(request_id))
65
+
66
+ def wait_for_request(
67
+ self,
68
+ request_id: str,
69
+ *,
70
+ timeout: float | None = None,
71
+ poll_interval: float | None = None,
72
+ ) -> ResponseData:
73
+ return poll(
74
+ lambda: self.get_request(request_id),
75
+ resource_id=request_id,
76
+ is_complete=_is_completed,
77
+ failed_states=_FAILED_STATES,
78
+ timeout=self._config.poll_timeout if timeout is None else timeout,
79
+ poll_interval=(self._config.poll_interval if poll_interval is None else poll_interval),
80
+ timeout_message=f"Timed out waiting for unblock request {request_id}",
81
+ )
82
+
83
+
84
+ class AsyncUnblockerResource(AsyncResource):
85
+ def __init__(self, transport: AsyncTransport, config: UnblockerConfig | None = None) -> None:
86
+ self._config = config or UnblockerConfig()
87
+ super().__init__(transport, self._config)
88
+
89
+ async def retrieve(
90
+ self, request: UnblockRequest | Mapping[str, Any] | None = None, **fields: Any
91
+ ) -> ResponseData:
92
+ return await self._post(_Routes.RETRIEVE, json=prepare_payload(request, fields))
93
+
94
+ async def entitlement(self) -> ResponseData:
95
+ return await self._get(_Routes.ENTITLEMENT)
96
+
97
+ async def list_requests(
98
+ self, *, page: int | None = None, page_size: int | None = None, **filters: Any
99
+ ) -> ResponseData:
100
+ return await self._get(
101
+ _Routes.REQUESTS,
102
+ params={RequestField.PAGE: page, RequestField.PAGE_SIZE: page_size, **filters},
103
+ )
104
+
105
+ async def create_request(
106
+ self, request: UnblockRequest | Mapping[str, Any] | None = None, **fields: Any
107
+ ) -> ResponseData:
108
+ return await self._post(_Routes.REQUESTS, json=prepare_payload(request, fields))
109
+
110
+ async def get_request(self, request_id: str) -> ResponseData:
111
+ return await self._get(_Routes.request(request_id))
112
+
113
+ async def cancel_request(self, request_id: str) -> ResponseData:
114
+ return await self._delete(_Routes.request(request_id))
115
+
116
+ async def wait_for_request(
117
+ self,
118
+ request_id: str,
119
+ *,
120
+ timeout: float | None = None,
121
+ poll_interval: float | None = None,
122
+ ) -> ResponseData:
123
+ return await poll_async(
124
+ lambda: self.get_request(request_id),
125
+ resource_id=request_id,
126
+ is_complete=_is_completed,
127
+ failed_states=_FAILED_STATES,
128
+ timeout=self._config.poll_timeout if timeout is None else timeout,
129
+ poll_interval=(self._config.poll_interval if poll_interval is None else poll_interval),
130
+ timeout_message=f"Timed out waiting for unblock request {request_id}",
131
+ )
@@ -0,0 +1,4 @@
1
+ """Public Scraper request and response types."""
2
+
3
+ from .resources.scraper.types import * # noqa: F403
4
+ from .resources.scraper.types import __all__ as __all__
@@ -0,0 +1,297 @@
1
+ Metadata-Version: 2.5
2
+ Name: raspbytes
3
+ Version: 1.1.0
4
+ Summary: Official Python SDK for the Raspbytes API
5
+ Project-URL: Documentation, https://docs.raspbytes.com/reference
6
+ Project-URL: Homepage, https://raspbytes.com
7
+ Project-URL: Issues, https://github.com/raspbytes-labs/python-sdk/issues
8
+ Project-URL: Repository, https://github.com/raspbytes-labs/python-sdk
9
+ Project-URL: Changelog, https://github.com/raspbytes-labs/python-sdk/blob/main/CHANGELOG.md
10
+ Author: Raspbytes
11
+ License-Expression: BSD-2-Clause
12
+ License-File: LICENSE
13
+ Keywords: browser-api,proxy,raspbytes,scraping
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.11
24
+ Requires-Dist: httpx<1,>=0.27
25
+ Provides-Extra: dev
26
+ Requires-Dist: mypy<2,>=1.13; extra == 'dev'
27
+ Requires-Dist: pytest-asyncio<2,>=1.4.1; extra == 'dev'
28
+ Requires-Dist: pytest-cov<8,>=6; extra == 'dev'
29
+ Requires-Dist: pytest<9,>=8; extra == 'dev'
30
+ Requires-Dist: ruff<1,>=0.8; extra == 'dev'
31
+ Requires-Dist: twine<8,>=7; extra == 'dev'
32
+ Description-Content-Type: text/markdown
33
+
34
+ # Raspbytes Python SDK
35
+
36
+ The official Python SDK for Raspbytes provides synchronous and asynchronous clients for
37
+ Proxies, Browser API, Web Unblocker, and Scraper API. It includes typed requests, structured
38
+ API errors, and helpers for polling long-running operations.
39
+
40
+ ## Installation
41
+
42
+ Requires Python 3.11 or later.
43
+
44
+ ```bash
45
+ python -m pip install raspbytes
46
+ ```
47
+
48
+ ## Authentication
49
+
50
+ Create an API key in the Raspbytes dashboard and set `RASPBYTES_API_KEY` in your environment.
51
+
52
+ ```bash
53
+ export RASPBYTES_API_KEY='rb_live_your_key_here'
54
+ ```
55
+
56
+ Both clients read `RASPBYTES_API_KEY` automatically. You can also pass `api_key=` when
57
+ creating a client.
58
+
59
+ ## Quick start
60
+
61
+ Fetch a page with Web Unblocker. The client context manager closes the HTTP connection pool.
62
+
63
+ ```python
64
+ from raspbytes import Raspbytes, UnblockRequest
65
+
66
+ with Raspbytes() as client:
67
+ page = client.unblocker.retrieve(UnblockRequest(url="https://example.com"))
68
+
69
+ print(page["status"], page["http_status"])
70
+ ```
71
+
72
+ ## Proxies
73
+
74
+ ```python
75
+ from raspbytes import ProxyConnectionParams, Raspbytes
76
+
77
+ with Raspbytes() as client:
78
+ connection = client.proxies.create(
79
+ ProxyConnectionParams(
80
+ proxy_type="residential",
81
+ country="US",
82
+ protocol="http",
83
+ )
84
+ )
85
+ proxy_url = connection["proxy_url"]
86
+ ```
87
+
88
+ Pass `proxy_url` directly to your HTTP client's proxy setting. The URL contains credentials.
89
+ Use `proxies.options()` to discover available locations and protocols for your account.
90
+ For a sticky connection, provide `session_type="sticky"` and a `session_id`. Use
91
+ `release_sticky_session(session_id)` to end the session early.
92
+
93
+ ## Browser API
94
+
95
+ ```python
96
+ from raspbytes import BrowserProxy, BrowserSessionParams, Raspbytes
97
+
98
+ with Raspbytes() as client:
99
+ created = client.browser.create_session(
100
+ BrowserSessionParams(
101
+ browser="chromium",
102
+ proxy=BrowserProxy(type="datacenter", country="GB"),
103
+ session_timeout_seconds=900,
104
+ )
105
+ )
106
+ try:
107
+ session = client.browser.wait_until_ready(created["id"])
108
+ browser_url = session["connection"]["url"]
109
+ # Use browser_url with Playwright's chromium.connect_over_cdp().
110
+ finally:
111
+ client.browser.terminate_session(created["id"])
112
+ ```
113
+
114
+ Keep the browser WebSocket URL private. Use `browser.proxy_options()` to discover available
115
+ proxy options for your account.
116
+
117
+ ## Web Unblocker
118
+
119
+ Use `retrieve()` to fetch a page in one request. To submit the request and collect the result
120
+ later, use `create_request()` and `wait_for_request()`.
121
+
122
+ ```python
123
+ from raspbytes import Raspbytes, UnblockRequest
124
+
125
+ with Raspbytes() as client:
126
+ queued = client.unblocker.create_request(UnblockRequest(url="https://example.com"))
127
+ completed = client.unblocker.wait_for_request(queued["id"], timeout=120)
128
+ ```
129
+
130
+ ## Scraper API
131
+
132
+ Google, Bing, and DuckDuckGo are managed scrapers under `client.scraper`. The managed catalog
133
+ exports a typed input dictionary and a revision-pinned handle for each scraper.
134
+
135
+ ```python
136
+ from uuid import uuid4
137
+
138
+ from raspbytes import Raspbytes
139
+ from raspbytes.managed_scrapers import GOOGLE_SEARCH, GoogleSearchInputs
140
+
141
+ with Raspbytes() as client:
142
+ scraper = client.scraper
143
+ inputs = GoogleSearchInputs(
144
+ query="coffee shops in London",
145
+ country="gb",
146
+ language="en",
147
+ device="desktop",
148
+ )
149
+ run = scraper.hub.run_managed(
150
+ GOOGLE_SEARCH,
151
+ inputs,
152
+ idempotency_key=str(uuid4()),
153
+ )
154
+ completed = scraper.runs.wait(run["id"], timeout=90)
155
+ print(completed.get("result"))
156
+ ```
157
+
158
+ Use `hub.list()` and `hub.get()` to discover available scrapers, revisions, and input and
159
+ output schemas. For private or newly discovered scrapers, pass the Hub ID and inputs to
160
+ `hub.run()` or `hub.run_and_wait()`. Use the scraper's output schema to validate the `result`
161
+ field for your application.
162
+
163
+ Use `runs.iterate()` to stream run history across pages and `runs.cancel(run_id)` to cancel a
164
+ server-side run. Cancelling an asyncio task stops the local wait. An idempotency key enables
165
+ response retries for a submission when the service marks the failure retryable. Use a new key
166
+ for each logical run and reuse it when retrying that run.
167
+
168
+ `COUNTRIES` provides ISO country codes and display names. For managed search scrapers, the
169
+ `country` input selects the search market and `configuration.country` sets the execution origin.
170
+
171
+ ### Manage Scraper workflows
172
+
173
+ Use `scraper.tasks` to save Hub inputs, create revisions, and run a saved task. Use
174
+ `scraper.schedules` to run a task on a cadence or submit an immediate run.
175
+
176
+ ```python
177
+ from raspbytes import Raspbytes
178
+ from raspbytes.managed_scrapers import GOOGLE_SEARCH
179
+ from raspbytes.scraper_types import CreateScrapingTaskParams
180
+
181
+ task_request = CreateScrapingTaskParams(
182
+ scraper=GOOGLE_SEARCH.id,
183
+ revision=GOOGLE_SEARCH.revision,
184
+ name="London coffee shops",
185
+ configuration={
186
+ "inputs": {
187
+ "query": "coffee shops in London",
188
+ "country": "gb",
189
+ "language": "en",
190
+ "device": "desktop",
191
+ }
192
+ },
193
+ )
194
+
195
+ with Raspbytes() as client:
196
+ task = client.scraper.tasks.create(task_request)
197
+ schedule = client.scraper.schedules.create(
198
+ {
199
+ "task": task["id"],
200
+ "name": "Weekday refresh",
201
+ "frequency": "custom",
202
+ "weekdays": [1, 2, 3, 4, 5],
203
+ "timezone": "Europe/London",
204
+ "time_of_day": "09:00:00",
205
+ }
206
+ )
207
+ run = client.scraper.schedules.run_now(schedule["id"])
208
+ finished = client.scraper.runs.wait(run["id"], timeout=90)
209
+ artifacts = client.scraper.storage.list_for_run(finished["id"])
210
+ ```
211
+
212
+ - `storage.iterate()` streams retained outputs. `create_download_link()` returns a short-lived
213
+ URL that should be treated as a secret.
214
+ - `monitoring.get(scope_type="task", scope_id=task_id, window="24h")` reads task metrics.
215
+ `list_scopes()` discovers available scopes. Policy methods read, patch, or evaluate alerts.
216
+ - `builder` manages account-owned scrapers, immutable revisions, access shares, and publication.
217
+ - `schedules.pause()` and `schedules.resume()` set an explicit enabled state. Use
218
+ `toggle_pause()` when you want the API to flip the current state.
219
+
220
+ Request and response types are available from `raspbytes.scraper_types`. With
221
+ `AsyncRaspbytes`, await the same methods and use `async for` with `storage.iterate()`.
222
+
223
+ ### Migrating from SERP
224
+
225
+ Replace `client.serp` with `client.scraper`. Choose `GOOGLE_SEARCH`, `BING_SEARCH`, or
226
+ `DUCKDUCKGO_SEARCH` in place of the old engine argument, and consult that scraper's input schema.
227
+ Read the output from the completed run's `result` field. Move `SerpConfig` to
228
+ `RaspbytesConfig(scraper=ScraperConfig(...))`.
229
+
230
+ ## Async client
231
+
232
+ The async client exposes the same resource and method names:
233
+
234
+ ```python
235
+ import asyncio
236
+
237
+ from raspbytes import AsyncRaspbytes
238
+
239
+
240
+ async def main() -> None:
241
+ async with AsyncRaspbytes() as client:
242
+ result = await client.scraper.hub.list(scope="raspbytes")
243
+ print(result)
244
+
245
+
246
+ asyncio.run(main())
247
+ ```
248
+
249
+ ## Configuration
250
+
251
+ Use `RaspbytesConfig` to share defaults across products, then configure individual products
252
+ with `ProxyConfig`, `BrowserConfig`, `UnblockerConfig`, or `ScraperConfig`. Both clients
253
+ accept the same configuration objects.
254
+
255
+ ```python
256
+ from raspbytes import BrowserConfig, Raspbytes, RaspbytesConfig
257
+
258
+ config = RaspbytesConfig(
259
+ timeout=30,
260
+ max_retries=2,
261
+ browser=BrowserConfig(timeout=120, poll_timeout=90, poll_interval=0.5),
262
+ )
263
+
264
+ with Raspbytes(config=config) as client:
265
+ options = client.browser.proxy_options()
266
+ ```
267
+
268
+ Product settings override constructor arguments for that product. Constructor arguments override
269
+ values in `RaspbytesConfig`. A polling argument such as `timeout=` on `scraper.runs.wait()`
270
+ applies to that call. The default API root is `https://api.raspbytes.com/api/v1/`.
271
+
272
+ ## Errors
273
+
274
+ ```python
275
+ from raspbytes import APIError, Raspbytes, RateLimitError, ScraperRunError
276
+
277
+ try:
278
+ with Raspbytes() as client:
279
+ client.scraper.runs.wait("run_id_from_submission", timeout=30)
280
+ except ScraperRunError as exc:
281
+ print(exc.request_id, exc.status, exc.code, exc.retryable)
282
+ except RateLimitError as exc:
283
+ print(exc.status_code, exc.code, exc.request_id)
284
+ except APIError as exc:
285
+ print(exc.status_code, exc.message, exc.body)
286
+ ```
287
+
288
+ `APIError` exposes the HTTP status, message, and response body. The SDK raises more specific
289
+ exceptions for common failures such as rate limits. It retries connection establishment failures
290
+ and API responses marked as retryable, subject to the configured retry limit.
291
+
292
+ ## Resources
293
+
294
+ - [Raspbytes API reference](https://docs.raspbytes.com/reference) for endpoints and schemas
295
+ - [Changelog](CHANGELOG.md) for SDK changes
296
+ - [BSD 2-Clause license](LICENSE)
297
+ - [Contributing](CONTRIBUTING.md) for SDK development
@@ -0,0 +1,39 @@
1
+ raspbytes/__init__.py,sha256=L3BAVJsHt7XRx4Yipn1EFthRxfHMwpY0Jh83CCZAGro,1881
2
+ raspbytes/client.py,sha256=-o4Vtbmc3gAXyThf4PULOz7W5DCeYzPJfFNxWcvcR2M,2917
3
+ raspbytes/config.py,sha256=kM7in3NK6qIJeKLTByTyoXX-Gsk5Yy7F65xhH4Ofpig,3909
4
+ raspbytes/countries.py,sha256=w9roCIw--0ApfxroDhVNuBNnuWyDJwUk2ZcCZAJKKig,11324
5
+ raspbytes/exceptions.py,sha256=7qJVsi-60GDcO8SVyT1XmU3NqGRce2PWa42SN4yVIg4,2854
6
+ raspbytes/managed_scrapers.py,sha256=NumBF421VTwqnC2e_PYkInCQXMx89jHFb87xkAhkPxE,191
7
+ raspbytes/models.py,sha256=RwlSspGiBP2bIuCULEoiRyvtSM9gxCQaOKr2S4a_aIM,3056
8
+ raspbytes/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
9
+ raspbytes/scraper_types.py,sha256=g8iRL_H8zwDs1iOXiebXtnnjJS8A7xEnM6AhDQpvkGw,159
10
+ raspbytes/_core/__init__.py,sha256=q6APS3H7ulh56k4zvAX1OehMj6f62lE3l36nM3QFsPs,43
11
+ raspbytes/_core/constants.py,sha256=rLZJZM1CSK8WEcKDVmWGysjdGejVpKHyQy1P46Ei5aw,801
12
+ raspbytes/_core/http.py,sha256=RqpIsPPZ69D4b7d_M_qwI3srlEzWKVUh8bbbj9Qn5ys,5263
13
+ raspbytes/_core/transport.py,sha256=PhmDM6FmfcjD0sx_uBkerpXEnU1enPzpyvbSP5B3WQc,6537
14
+ raspbytes/_core/types.py,sha256=NPFidGjTdU2CFiQhxi8umsuWmF41wwkX2LflKsUvkFE,406
15
+ raspbytes/_core/version.py,sha256=8IRG8rQ_S_55rRnW0nUpsdfAT7p0uHm1KNIHLzeRUrQ,264
16
+ raspbytes/resources/__init__.py,sha256=6u8Sv5xbNuE2FAhWNlb-aBlInwrL1oGkceOGfroxVFs,533
17
+ raspbytes/resources/_base.py,sha256=MtlUCPvKAuoaFWO3X9yzJmC6-jbl8OKN_3PX6UzYojs,3056
18
+ raspbytes/resources/_polling.py,sha256=Zmk6j2-Pq2dN6mHXlApqhF5lxSCmsL-4QNfrrhsth74,2359
19
+ raspbytes/resources/browser.py,sha256=NEk4X95ORr9Nul1CJnK-lw_uUA2OyKl1cXtnXY3C8U4,6403
20
+ raspbytes/resources/proxies.py,sha256=nQpIPd-JD75D24cgVef6bLghQPjo0G6KtpkczQsyDxM,1816
21
+ raspbytes/resources/unblocker.py,sha256=rTuCY721eFqotibGHwvD_9MSJ6xEtqUVZRx3U_W8rr0,4895
22
+ raspbytes/resources/scraper/__init__.py,sha256=OzEEtAJGs1s1PM8zt5nh9-IboVvHrUEURYYcXb2esMk,1852
23
+ raspbytes/resources/scraper/_managed.py,sha256=9uurYlC42DJZLPfJO-2eiPA4yDv2HXjCtgNKUE_HFzA,291
24
+ raspbytes/resources/scraper/_request.py,sha256=j4vce2rD5fSPpDrbHkDBLKSRDixq1lpDc9Fn6LABLxM,4464
25
+ raspbytes/resources/scraper/builder.py,sha256=EsUWlwTEiu4_Wstv0gKwuXashpyzz76pnLn8HlM0Jio,7323
26
+ raspbytes/resources/scraper/hub.py,sha256=AK5T6s2yQEJLts7yhrR5HTVFXwo7BZd2fDJ2-geQyBE,5665
27
+ raspbytes/resources/scraper/monitoring.py,sha256=eKDrolRh88Y4I3lBG8J2PxBMKzO88A32QAkFz5KmiFo,4584
28
+ raspbytes/resources/scraper/runs.py,sha256=lSdAzX8kXvbttsezmtSmtXz5PJdo2cjNSNOglBWjJIQ,7588
29
+ raspbytes/resources/scraper/schedules.py,sha256=_tH1T7M2CeGJolllLQAR-UvQswbjYxVsPkBk_r14oH0,6643
30
+ raspbytes/resources/scraper/storage.py,sha256=AiRhp_RfMUS9bvWY6Cy3KVAG4SVLr_1uv1QenFANoJE,5428
31
+ raspbytes/resources/scraper/tasks.py,sha256=oYKTWcwis2ZCVIrKju4V1I_D0rP25wKZlu1rtHhZsBg,4869
32
+ raspbytes/resources/scraper/types.py,sha256=Aoohyc7I5qJZFnDoMuqXVLUst_jtRhTh9SXHhwAihE0,4285
33
+ raspbytes/resources/scraper/_generated/__init__.py,sha256=iIj5GjT0NzI9Fv42lFzFWebsWjm7kCPIJpsDLaRH2r8,60
34
+ raspbytes/resources/scraper/_generated/managed.py,sha256=XmKSPmFIjq3k2qNbI8zCL4HeUJ0L_Yq0n8X6y8IxqYc,5508
35
+ raspbytes/resources/scraper/_generated/wire.py,sha256=JgeLRljn4CG9PX3YE7ZEO-G2-O5JyVLJ7qZ_MMnguig,16928
36
+ raspbytes-1.1.0.dist-info/METADATA,sha256=AEQJnuGJQnvrlVmChgPH52q538P2lUxe6Mnf45u8jZs,10223
37
+ raspbytes-1.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
38
+ raspbytes-1.1.0.dist-info/licenses/LICENSE,sha256=wv4qJvP6fkFdK5ubR9tikdKMEk_WDzqKnKyBs95G8AI,1309
39
+ raspbytes-1.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,25 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 2026 Phoenix Point Limited
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice,
9
+ this list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
+ POSSIBILITY OF SUCH DAMAGE.