Skip to main content

Typed Python SDK for the ScrapeDrive scraping API.

Project description

scrapedrive-python

Typed Python SDK for the ScrapeDrive API, built around httpx and managed with uv.

Install

uv sync

For packaging consumers:

uv add scrapedrive

Quick Start

Set your API key in the environment:

export SCRAPEDRIVE_API_KEY=your_key

Sync client

from scrapedrive import ScrapeDrive

with ScrapeDrive() as client:
    response = client.scrape(
        "https://example.com",
        result_type="page_text",
        render_js=False,
    )
    print(response.text)

Async job flow

from scrapedrive import ScrapeDrive

with ScrapeDrive() as client:
    job = client.submit_scrape(
        "https://example.com",
        render_js=True,
        wait_browser="networkidle",
        scrape_tier="advanced",
        country_code="US",
    )
    completed = client.wait_for_job(job.id, poll_interval=2.0, timeout=60.0)
    print(completed.result)

Native async client

import asyncio

from scrapedrive import AsyncScrapeDrive


async def main() -> None:
    async with AsyncScrapeDrive() as client:
        response = await client.scrape("https://example.com", result_type="page_markdown")
        print(response.text)


asyncio.run(main())

Forward headers to the target site

from scrapedrive import ScrapeDrive

with ScrapeDrive() as client:
    response = client.scrape(
        "https://example.com/private",
        target_headers={"Authorization": "Bearer token"},
    )
    print(response.text)

The SDK automatically rewrites forwarded target headers to the sdrive- format required by ScrapeDrive and enables forward_sdrive_headers=true.

Geography Defaults

For advanced and hyperdrive requests, the SDK defaults country_code to US when you do not pass one explicitly. This avoids ScrapeDrive's random geo selection. If you want a site-local country instead, pass it per request:

from scrapedrive import ScrapeDrive

with ScrapeDrive() as client:
    response = client.scrape(
        "https://example.de",
        scrape_tier="advanced",
        country_code="DE",
    )

AI Agents

Provider-agnostic agent guidance lives in AGENTS.md. This repo does not ship provider-specific agent config.

Development

uv run ruff check
uv run ruff format
uv run pytest

Live integration tests are opt-in:

SCRAPEDRIVE_RUN_LIVE_TESTS=1 uv run pytest tests/test_live.py

Build

uv build

PyPI

The package is prepared for PyPI publishing via GitHub Actions Trusted Publishing. See RELEASING.md for the wheel smoke-install workflow, PyPI setup, and release checklist.

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

scrapedrive-0.1.0.tar.gz (23.8 kB view details)

Uploaded Source

Built Distribution

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

scrapedrive-0.1.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scrapedrive-0.1.0.tar.gz
  • Upload date:
  • Size: 23.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for scrapedrive-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cf24f8c706beba957a0b9a6f61f6072ad7170211df8545005107b316c618a7ce
MD5 8c72565fc1d4cfd3c6081d66bfa3329c
BLAKE2b-256 8155050b3962882431fc154466b056a302e3fbcaa6d149cecd5d4949ab527d8f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: scrapedrive-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for scrapedrive-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d4be4f15195f5c309edbec5ebc56e5152842dc719d656ca65c4d1ce0db601012
MD5 0a9ef2f3426a39b98093cfac01d77bea
BLAKE2b-256 e2203f530aa1ac9e908f64e6776be2b0153afccd8da86199b83f645d1051942a

See more details on using hashes here.

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