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 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.1.tar.gz (34.2 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.1-py3-none-any.whl (36.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scrape_do_python-0.1.1.tar.gz
  • Upload date:
  • Size: 34.2 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.1.tar.gz
Algorithm Hash digest
SHA256 31a3da5f4dcebde79d9e00044d2e37607fe2fdf2c8835eed69fc00b476f5cb4d
MD5 5eafb51ac496468a186ef42ebab431dc
BLAKE2b-256 8c6f00c67a5152f91418a05bb80a8ebd840853fd68f067d3de86d6ead7533523

See more details on using hashes here.

Provenance

The following attestation bundles were made for scrape_do_python-0.1.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for scrape_do_python-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 91e00d3cd33df71b912075d360945589abe45786dd12a3181d60ac521fad414a
MD5 959a29bc9d858850cb5904ed4acc4728
BLAKE2b-256 95ad4aa9fcae5f674682b40fbf7333d0f67f9ec90226102bcb6f0e596cea8490

See more details on using hashes here.

Provenance

The following attestation bundles were made for scrape_do_python-0.1.1-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