Skip to main content

A Python SDK for the Scrape.do API

Project description

PyPI Python License Docs codecov codecov

scrape-do-python

A Python SDK for the Scrape.do web-scraping proxy API.

Built on httpx and pydantic v2, with strict request validation, automatic retries on gateway errors, sticky-session validation, and SDK-native lifecycle hooks.

Status

v0.1.0 → Early but functional

Synchronous client is shipped

Async and Proxy-Mode clients are on the Roadmap

Breaking changes are possible between 0.x minor versions.

Installation

pip install scrape-do-python

Quickstart

from scrape_do.client import ScrapeDoClient

# API Token pulled from SCRAPE_DO_API_KEY env variable
# Can also be provided via 'api_token' argument

with ScrapeDoClient() as client:
    response = client.get(
        "https://example.com",
        super=True,
        render=True,
        return_json=True,
        show_frames=True,
        )
    
    print(response.is_proxy_error)

    print(response.frames[0].url)
    
    print(response.remaining_credits)

Features

Type-Checked Request Parameters

Request parameters are fully type-checked and automatically validated via the RequestParameters pydantic model

Smart Routing

ScrapeDoClient.request() accepts either **api_kwargs, a pre-built RequestParameters, or a raw api.scrape.do URL for request parameters

Automatic Retries

ScrapeDoClient can automatically retry requests on Scrape.do gateway errors (429 / 502 / 510) with customizable backoff (static or callable)

Sticky-Session Validation

Supply a session_validator callback to detect proxy node rotations and raise RotatedSessionError

SDK-Native Event Hooks

request / response / retry lifecycle hooks, distinct from httpx's transport-level hooks.

Strongly-Typed Responses

ScrapeDoResponse exposes the parsed JSON envelope, browser action results, screenshots, and network/websocket logs.

Browser Automation

Pydantic models for Browser Actions providing validation and type-hinting for the playWithBrowser API parameter

Documentation

Full API Reference

Roadmap

See ROADMAP for the upcoming Async Client, Proxy-Mode Clients, Async-API Support, and Plugin Support

Contributing

Pull Requests, Bug Reports, and Feature Requests are all welcome.

See CONTRIBUTING for local setup, test commands, and PR conventions

Community

Participation is governed by our Code of Conduct. To privately report a security issue, see the Security Policy.

License

scrape-do-python is released under the MIT License

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

scrape_do_python-0.1.0.tar.gz (33.7 kB view details)

Uploaded Source

Built Distribution

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

scrape_do_python-0.1.0-py3-none-any.whl (36.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for scrape_do_python-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f17d44a3c681e86f4d346d0d06a4e42ae923c7b0c74ec5ee16ebda925548c5c9
MD5 bc3637bbfcd088a186d67ab9822f658b
BLAKE2b-256 cf5ad16ee6d820fa675623f28a4c2c7d8374bf0667905256bae23820ee5e75cd

See more details on using hashes here.

Provenance

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

Publisher: ci.yml on svdC1/scrape-do-python

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

File details

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

File metadata

File hashes

Hashes for scrape_do_python-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c0d83b025364a438c1fb3fe8f07fe2acd39e63578b713958adeff4377c691c2e
MD5 eed44028762c0f73eff5fd81a8516bff
BLAKE2b-256 f6a15d1541320c6d0f27f9309497c01cfbe64bb7b1d50eafa775fda2f92957f8

See more details on using hashes here.

Provenance

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

Publisher: ci.yml on svdC1/scrape-do-python

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