Rayon Python SDK
A synchronous client for POST /solve on the Rayon API. Python 3.10 or newer is required.
Install from PyPI:
python -m pip install rayon-sdk-py
import os
from rayon_sdk_py import solve
result = solve(
"https://example.com/page",
os.environ["RAYON_API_KEY"],
# Optional JSON fingerprint values:
profile={"user_agent": "your browser user agent"},
)
print(result.status, result.method, result.duration_ms)
solve(target_url, api_key, *, profile=None, base_url="https://api.rayonapi.com", timeout=150)
performs one request using curl_cffi Chrome impersonation. Timeout is a finite positive
number of seconds. The SDK disables redirects and environment proxies, and never retries.
Decoded response bodies are limited to 2 MiB; larger responses stop the transfer
and raise InvalidResponseError.
Custom API endpoints require HTTPS; HTTP is supported only for localhost, 127.0.0.1,
or [::1] development endpoints. URLs cannot contain credentials or fragments;
the API base URL also cannot contain a query.
The request body contains only target_url and, when supplied, profile.
The API key is sent as a Bearer authorization header. Use an account and target
domain approved for your application.
An accepted result contains exactly one six-header family with a variable prefix
and the suffixes a, b, c, d, f, and z; d may be empty.
Acceptance means the headers were captured. It does not mean the target website
verified them. result.errors can contain diagnostics from earlier solver tiers
even when a fallback succeeds.
SolveResult exposes status, method, target_url, duration_ms, headers,
cookies, profile_used, and errors. Headers, cookies, URL, profile, and diagnostics
are excluded from its repr because replay data can be sensitive.
Cookies remain a list of records with required string fields name, value,
domain, and path. Extra JSON metadata is preserved. Cookie scope matters:
do not flatten cookies into a name/value dictionary. The SDK does not invent
secure, expiry, or other browser attributes absent from the API response.
When replaying a result, preserve cookie domains and paths and use the returned
profile_used values for a compatible browser fingerprint.
from curl_cffi.requests import Cookies
jar = Cookies()
for cookie in result.cookies:
jar.set(cookie["name"], cookie["value"], domain=cookie["domain"], path=cookie["path"])
# result.headers, jar, and result.profile_used are available for your replay client.
Handle failures explicitly:
import os
from rayon_sdk_py import HTTPError, RayonError, SolveFailedError, solve
try:
result = solve("https://example.com/page", os.environ["RAYON_API_KEY"])
except SolveFailedError as exc:
# HTTP 200 with a failed/rejected result also raises.
print(exc.result.status)
except HTTPError as exc:
print(exc.status_code, exc.request_id, exc.retry_after)
except RayonError as exc:
print(str(exc))
All SDK errors inherit from RayonError. ValidationError is raised before
network access; TransportError covers network failures; RedirectError is an
HTTPError; InvalidResponseError covers invalid JSON or malformed responses.
Exception messages do not include response bodies, credentials, or underlying
transport messages. HTTP response errors expose status_code, request_id, and
retry_after (a validated seconds or HTTP date header string, when present).
Invalid diagnostic headers or values reflecting the API key are discarded.
Decide whether and when
to retry in your application; admitted solve attempts can consume quota.
For local development:
python -m venv .venv
. .venv/bin/activate
python -m pip install -e '.[dev]'
python -m pytest
python -m build
python -m twine check dist/*
Tests are offline and patch the transport. CI tests Python 3.10, 3.12, and 3.14 and builds the wheel and source distribution. See RELEASE.md for the trusted publisher setup. Licensed under MIT.
Metadata
Release files for rayon-sdk-py 0.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 | |
|---|---|---|---|
| rayon_sdk_py-0.1.0.tar.gz | 13.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rayon_sdk_py-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.0 kB
Release files / rayon_sdk_py-0.1.0.tar.gz
| Download URL | rayon_sdk_py-0.1.0.tar.gz |
|---|---|
| Size | 13.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
02a1dafc494a4a9764311d65a4b81b6e46782030c3489f96378cab19496a489b
|
|
BLAKE2b-256 checksum How to use checksums |
d9d61de45e2e4e4336ae553fc22e7bc79254c93a80b8f6aa3a3bdf2051da0062
|
| 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 Oct 12, 2026.
Transparency logRelease files / rayon_sdk_py-0.1.0-py3-none-any.whl
| Download URL | rayon_sdk_py-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3c99c6d99868a455cc84632276cba5dcea067d104830eca6697820c351517a26
|
|
BLAKE2b-256 checksum How to use checksums |
a5f772bcacab55df56afdce3435dd285d2e806ad8d46a1225d933255e9b43fb1
|
| 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 Oct 12, 2026.
Transparency log