Raspbytes Python SDK
The official Python SDK for Raspbytes provides synchronous and asynchronous clients for Proxies, Browser API, Web Unblocker, and Scraper API. It includes typed requests, structured API errors, and helpers for polling long-running operations.
Installation
Requires Python 3.11 or later.
python -m pip install raspbytes
Authentication
Create an API key in the Raspbytes dashboard and set RASPBYTES_API_KEY in your environment.
export RASPBYTES_API_KEY='rb_live_your_key_here'
Both clients read RASPBYTES_API_KEY automatically. You can also pass api_key= when
creating a client.
Quick start
Fetch a page with Web Unblocker. The client context manager closes the HTTP connection pool.
from raspbytes import Raspbytes, UnblockRequest
with Raspbytes() as client:
page = client.unblocker.retrieve(UnblockRequest(url="https://example.com"))
print(page["status"], page["http_status"])
Proxies
from raspbytes import ProxyConnectionParams, Raspbytes
with Raspbytes() as client:
connection = client.proxies.create(
ProxyConnectionParams(
proxy_type="residential",
country="US",
protocol="http",
)
)
proxy_url = connection["proxy_url"]
Pass proxy_url directly to your HTTP client's proxy setting. The URL contains credentials.
Use proxies.options() to discover available locations and protocols for your account.
For a sticky connection, provide session_type="sticky" and a session_id. Use
release_sticky_session(session_id) to end the session early.
Browser API
from raspbytes import BrowserProxy, BrowserSessionParams, Raspbytes
with Raspbytes() as client:
created = client.browser.create_session(
BrowserSessionParams(
browser="chromium",
proxy=BrowserProxy(type="datacenter", country="GB"),
session_timeout_seconds=900,
)
)
try:
session = client.browser.wait_until_ready(created["id"])
browser_url = session["connection"]["url"]
# Use browser_url with Playwright's chromium.connect_over_cdp().
finally:
client.browser.terminate_session(created["id"])
Keep the browser WebSocket URL private. Use browser.proxy_options() to discover available
proxy options for your account.
Web Unblocker
Use retrieve() to fetch a page in one request. To submit the request and collect the result
later, use create_request() and wait_for_request().
from raspbytes import Raspbytes, UnblockRequest
with Raspbytes() as client:
queued = client.unblocker.create_request(UnblockRequest(url="https://example.com"))
completed = client.unblocker.wait_for_request(queued["id"], timeout=120)
Scraper API
Google, Bing, and DuckDuckGo are managed scrapers under client.scraper. The managed catalog
exports a typed input dictionary and a revision-pinned handle for each scraper.
from uuid import uuid4
from raspbytes import Raspbytes
from raspbytes.managed_scrapers import GOOGLE_SEARCH, GoogleSearchInputs
with Raspbytes() as client:
scraper = client.scraper
inputs = GoogleSearchInputs(
query="coffee shops in London",
country="gb",
language="en",
device="desktop",
)
run = scraper.hub.run_managed(
GOOGLE_SEARCH,
inputs,
idempotency_key=str(uuid4()),
)
completed = scraper.runs.wait(run["id"], timeout=90)
print(completed.get("result"))
Use hub.list() and hub.get() to discover available scrapers, revisions, and input and
output schemas. For private or newly discovered scrapers, pass the Hub ID and inputs to
hub.run() or hub.run_and_wait(). Use the scraper's output schema to validate the result
field for your application.
Use runs.iterate() to stream run history across pages and runs.cancel(run_id) to cancel a
server-side run. Cancelling an asyncio task stops the local wait. An idempotency key enables
response retries for a submission when the service marks the failure retryable. Use a new key
for each logical run and reuse it when retrying that run.
COUNTRIES provides ISO country codes and display names. For managed search scrapers, the
country input selects the search market and configuration.country sets the execution origin.
Manage Scraper workflows
Use scraper.tasks to save Hub inputs, create revisions, and run a saved task. Use
scraper.schedules to run a task on a cadence or submit an immediate run.
from raspbytes import Raspbytes
from raspbytes.managed_scrapers import GOOGLE_SEARCH
from raspbytes.scraper_types import CreateScrapingTaskParams
task_request = CreateScrapingTaskParams(
scraper=GOOGLE_SEARCH.id,
revision=GOOGLE_SEARCH.revision,
name="London coffee shops",
configuration={
"inputs": {
"query": "coffee shops in London",
"country": "gb",
"language": "en",
"device": "desktop",
}
},
)
with Raspbytes() as client:
task = client.scraper.tasks.create(task_request)
schedule = client.scraper.schedules.create(
{
"task": task["id"],
"name": "Weekday refresh",
"frequency": "custom",
"weekdays": [1, 2, 3, 4, 5],
"timezone": "Europe/London",
"time_of_day": "09:00:00",
}
)
run = client.scraper.schedules.run_now(schedule["id"])
finished = client.scraper.runs.wait(run["id"], timeout=90)
artifacts = client.scraper.storage.list_for_run(finished["id"])
storage.iterate()streams retained outputs.create_download_link()returns a short-lived URL that should be treated as a secret.monitoring.get(scope_type="task", scope_id=task_id, window="24h")reads task metrics.list_scopes()discovers available scopes. Policy methods read, patch, or evaluate alerts.buildermanages account-owned scrapers, immutable revisions, access shares, and publication.schedules.pause()andschedules.resume()set an explicit enabled state. Usetoggle_pause()when you want the API to flip the current state.
Request and response types are available from raspbytes.scraper_types. With
AsyncRaspbytes, await the same methods and use async for with storage.iterate().
Migrating from SERP
Replace client.serp with client.scraper. Choose GOOGLE_SEARCH, BING_SEARCH, or
DUCKDUCKGO_SEARCH in place of the old engine argument, and consult that scraper's input schema.
Read the output from the completed run's result field. Move SerpConfig to
RaspbytesConfig(scraper=ScraperConfig(...)).
Async client
The async client exposes the same resource and method names:
import asyncio
from raspbytes import AsyncRaspbytes
async def main() -> None:
async with AsyncRaspbytes() as client:
result = await client.scraper.hub.list(scope="raspbytes")
print(result)
asyncio.run(main())
Configuration
Use RaspbytesConfig to share defaults across products, then configure individual products
with ProxyConfig, BrowserConfig, UnblockerConfig, or ScraperConfig. Both clients
accept the same configuration objects.
from raspbytes import BrowserConfig, Raspbytes, RaspbytesConfig
config = RaspbytesConfig(
timeout=30,
max_retries=2,
browser=BrowserConfig(timeout=120, poll_timeout=90, poll_interval=0.5),
)
with Raspbytes(config=config) as client:
options = client.browser.proxy_options()
Product settings override constructor arguments for that product. Constructor arguments override
values in RaspbytesConfig. A polling argument such as timeout= on scraper.runs.wait()
applies to that call. The default API root is https://api.raspbytes.com/api/v1/.
Errors
from raspbytes import APIError, Raspbytes, RateLimitError, ScraperRunError
try:
with Raspbytes() as client:
client.scraper.runs.wait("run_id_from_submission", timeout=30)
except ScraperRunError as exc:
print(exc.request_id, exc.status, exc.code, exc.retryable)
except RateLimitError as exc:
print(exc.status_code, exc.code, exc.request_id)
except APIError as exc:
print(exc.status_code, exc.message, exc.body)
APIError exposes the HTTP status, message, and response body. The SDK raises more specific
exceptions for common failures such as rate limits. It retries connection establishment failures
and API responses marked as retryable, subject to the configured retry limit.
Resources
- Raspbytes API reference for endpoints and schemas
- Changelog for SDK changes
- BSD 2-Clause license
- Contributing for SDK development
Metadata
Release files for raspbytes 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| raspbytes-1.1.0.tar.gz | 30.0 kB | With provenance | Details for raspbytes-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| raspbytes-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for raspbytes-1.1.0-py3-none-any.whl |
Total release size: 72.7 kB
Release files / raspbytes-1.1.0.tar.gz
| Download URL | raspbytes-1.1.0.tar.gz |
|---|---|
| Size | 30.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b5ecd920c6438e91880428a84d384d0d50bdbaaebde081e4806533e9c36c0de3
|
|
BLAKE2b-256 checksum How to use checksums |
152d2c349258dec35cc6c02c8fa3e0088982e9c7a8531330ec9bb00ad98c5f03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logRelease files / raspbytes-1.1.0-py3-none-any.whl
| Download URL | raspbytes-1.1.0-py3-none-any.whl |
|---|---|
| Size | 42.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f7455ad7289651fc76510c958dddb1042a2df42ee21c93610b660629f9d7e976
|
|
BLAKE2b-256 checksum How to use checksums |
a91276b9b5fbb1c22fcdccf8e4ea801883e37ea3def2265f6080c5c7d9075707
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logSecurity for raspbytes 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for raspbytes-1.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.