Skip to main content

webpipe-sdk (Python)

Official Python SDK for WebPipe.ai — turn any webpage into clean, structured data.

Install

pip install webpipe-sdk

Requires Python ≥ 3.9. Depends only on httpx + pydantic.

Quick Start

from webpipe import WebpipeClient

client = WebpipeClient()  # reads WEBPIPE_API_KEY env var, or pass api_key="wc-..."

Scrape a page

doc = client.scrape("https://example.com", formats=["markdown", "links", "metadata"])
print(doc.markdown)
print(doc.metadata.title)

Structured JSON extraction with a schema:

doc = client.scrape(
    "https://go.dev/doc/effective_go",
    formats=["json"],
    json_schema={
        "type": "object",
        "properties": {
            "title": {"type": "string"},
            "sections": {"type": "array", "x-source": "headings"},
        },
    },
)
print(doc.json)

Crawl a whole site (polls automatically)

job = client.crawl(
    "https://docs.example.com",
    limit=50,
    scrape_options={"formats": ["markdown"]},
)
for page in job.data:
    print(page.metadata.source_url, page.metadata.title)

Need control? job = client.start_crawl(url) returns immediately; poll with client.get_crawl_status(job.id).

Browser session (JS-rendered / logged-in pages)

with client.browser.create(url="https://example.com/login") as session:
    session.wait_until_running()
    session.fill("input[name=email]", "you@example.com")
    session.fill("input[name=password]", "secret")
    session.press("Enter", wait_after=3000)

    doc = session.navigate("https://example.com/dashboard", formats=["markdown"])
    print(doc.markdown)
    session.save_session()  # reuse login state next time via session_name
# session.close() is called automatically on exit

Map (discover all URLs)

for link in client.map("https://example.com", limit=100, search="blog"):
    print(link.url, link.title)

Async

import asyncio
from webpipe import AsyncWebpipeClient

async def main():
    async with AsyncWebpipeClient() as client:
        doc = await client.scrape("https://example.com", formats=["markdown"])
        print(doc.markdown)

asyncio.run(main())

Errors

from webpipe import AuthenticationError, RateLimitError, NotFoundError, WebpipeError

try:
    client.scrape("https://example.com")
except AuthenticationError:
    ...  # bad API key
except RateLimitError as e:
    ...  # e.status_code == 429, e.message keeps the server's error text
except WebpipeError:
    ...  # anything else

429 and 5xx responses are retried automatically with exponential backoff (max_retries=2 by default).

Configuration

Param Env var Default
api_key WEBPIPE_API_KEY — (required)
base_url WEBPIPE_API_URL https://api.web2json.ai
timeout — 60s
max_retries — 2

Development

python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest

Metadata

Release files for webpipe-sdk 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for webpipe-sdk 0.1.2
File Size Uploaded Provenance Actions
webpipe_sdk-0.1.2.tar.gz 12.5 kB Without provenance Details for webpipe_sdk-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for webpipe-sdk 0.1.2
File Interpreter ABI Platform Actions
webpipe_sdk-0.1.2-py3-none-any.whl Python 3 none any Details for webpipe_sdk-0.1.2-py3-none-any.whl

Total release size: 25.4 kB

Release files / webpipe_sdk-0.1.2.tar.gz

Download URL webpipe_sdk-0.1.2.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6a37649fbb6b62530a3a6f84318e05bdf2054c74595ca848762849b079de0e92
BLAKE2b-256 checksum
How to use checksums
0a80f73dffc5d18efd069f0d06ba96eab98ed9e9695d08110ad89f776b4c603f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / webpipe_sdk-0.1.2-py3-none-any.whl

Download URL webpipe_sdk-0.1.2-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b24f6318db810ca9c025768db5704c4317f8034670c7f6af7dcfced6a0c5b59
BLAKE2b-256 checksum
How to use checksums
d4fe58fb286ee477175ee22f3b2fe1ace7c902ba05490ac3b1e5b65dd8a21334
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for webpipe-sdk 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page