Skip to content

svdC1/scrape-do-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

scrape-do-python

PyPI Python License Docs codecov codecov

A Python SDK for the Scrape.do web-scraping proxy API, built on httpx and pydantic v2


Quickstart

Install

pip install scrape-do-python

Make a Request

from scrape_do import ScrapeDoClient

# API token is pulled from `SCRAPE_DO_API_KEY` 

# (override with `api_token=...`)

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

response.raise_for_status()
print(response.target_status_code) # 200
print(response.remaining_credits)  # 300000.0
response.screenshots[0].to_file("page.png")

Features

Sync & Async Sync and Async clients for both API Gateway and Proxy Mode
Async API Support Submit, poll, and fetch jobs against q.scrape.do with the Async API Client
Parameter Validation Every request parameter is validated locally by the RequestParameters pydantic model
Typed Responses ScrapeDoResponse exposes response fields as pydantic models for easy access
Browser Automation Build playWithBrowser sequences from typed Browser Action Models
Session Management Use a custom session_validator function to track proxy rotations when using the session_id parameter
Native Event Hooks Provide custom request / response / retry / poll hooks that fire at the logical execution boundary
Automatic Retries All clients implement automatic retries on transient gateway/network errors with a customisable Backoff Strategy

Help

Documentation Full API Reference
Examples Curated Usage Examples
Roadmap What's Planned
Changelog What's Already Shipped

Contributing

Pull Requests, bug reports, and feature requests are all welcome

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

About

Python SDK for the Scrape.do web-scraping proxy API — local request validation, automatic retries on gateway errors, and more

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Contributors

Languages