Skip to main content

Official Python client for the Scraping SaaS REST API

Project description

fetchora — Python SDK

Official Python client for the Scraping SaaS REST API. Sync + async interfaces, zero-setup auth (SCRAPING_API_KEY env var), wait-with-fallback semantics.

Install

pip install fetchora

Requires Python 3.9+.

Quickstart

from fetchora import ScrapingClient

client = ScrapingClient()  # SCRAPING_API_KEY read from env
page = client.scrape("https://example.com")
print(page["result"]["markdown"])
import asyncio
from fetchora import AsyncScrapingClient

async def main():
    async with AsyncScrapingClient() as client:
        page = await client.scrape("https://example.com")
        print(page["result"]["markdown"])

asyncio.run(main())

Environment variables

Variable Required Default Description
SCRAPING_API_KEY yes (unless passed explicitly) Bearer token
SCRAPING_BASE_URL no https://api.scraping.io Override for self-hosted / dev

API reference

Method REST
get_balance() GET /v1/billing/balance
scrape(url, *, wait=True, wait_timeout_s=60, cookies=None, format="markdown") POST /v1/scrape + poll
get_scrape_status(task_id) GET /v1/scrape/{id}
crawl(urls, *, wait=True, wait_timeout_s=600, cookies=None, include_items=True) POST /v1/crawl + poll
get_crawl_status(crawl_id, *, include_items=True) GET /v1/crawl/{id} + fan-out

On wait=True timeout → ScrapingTimeoutError. On wait=False → returns {"task_id": ...} / {"crawl_id": ...} immediately.

Errors

All errors inherit from fetchora.ScrapingError:

Class Code Trigger
InvalidApiKeyError invalid_api_key 401
InsufficientBalanceError insufficient_balance 402
ForbiddenError forbidden 403
NotFoundError not_found 404
AlreadyTerminalError already_terminal 409
InvalidInputError invalid_input 400, 422
ServerError server_error 5xx
ScrapingTimeoutError timeout SDK wait-timeout

License

MIT. See repo root for source.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fetchora-0.1.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fetchora-0.1.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file fetchora-0.1.0.tar.gz.

File metadata

  • Download URL: fetchora-0.1.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fetchora-0.1.0.tar.gz
Algorithm Hash digest
SHA256 85e6f49e5c9475c7a37e5e49cbfe5cde22b53ef4e6c9c936e5e023d7cf60ed0b
MD5 3b7de483f893d40240b29e186d9dbd5b
BLAKE2b-256 8b34ea6a5a3f43ca39eee29897e5806f6cb4ff8f1db00ddb94065dbd9f273e57

See more details on using hashes here.

Provenance

The following attestation bundles were made for fetchora-0.1.0.tar.gz:

Publisher: publish-python-sdk.yml on Nodirbek2001/scraper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fetchora-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fetchora-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fetchora-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e9fbc8f9d08abdc802cc08dc5dbef545af0ca3c6bfbe6f3435e7702affbb8fb6
MD5 d0eaf7eec05367ae73612794f3128670
BLAKE2b-256 e63bcb0f8977d64ae2e589a7c2c63b6e4d6435ed214661f0d398e8e245ed3cee

See more details on using hashes here.

Provenance

The following attestation bundles were made for fetchora-0.1.0-py3-none-any.whl:

Publisher: publish-python-sdk.yml on Nodirbek2001/scraper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page