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

Uploaded Python 3

File details

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

File metadata

  • Download URL: scrapedrive-0.1.1.tar.gz
  • Upload date:
  • Size: 23.9 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.1.tar.gz
Algorithm Hash digest
SHA256 b8a5737ccc775b5449a75e0dca607245c7762108e3c2a3032e91c925a19fc049
MD5 44d428e6a8fd6bac40ac7a1d660b59e5
BLAKE2b-256 ae534b00530480515d9c351ec3ef1743d192a09792502f33ee7a820572ac0d06

See more details on using hashes here.

File details

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

File metadata

  • Download URL: scrapedrive-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3220f033e6e9b453966f4b857fe2b16c14d8c08c13206ce222bc2683f762529f
MD5 6426ce4c6e4d35eb56ea31f0b63ae655
BLAKE2b-256 e5f729e69134ab05603ee6e7573c8292c03286a4da17267ef7b0966c965bcd2c

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