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

Release files for webpipe-sdk 0.1.1

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.1
File Size Uploaded
webpipe_sdk-0.1.1.tar.gz 12.5 kB Details

Built distribution (wheel)

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

Total release size: 25.4 kB

Release files / webpipe_sdk-0.1.1.tar.gz

Download URL webpipe_sdk-0.1.1.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d92449807ab336c3e270780301dee8a2b2fd179463c4f1a325798f387b4b32f7
BLAKE2b-256 checksum
How to use checksums
51a98d7ab73842d8bf5cda11fdae2482d499950b730dd221a42fbc16aaebae87
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.1-py3-none-any.whl

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

Release history Release notifications | RSS feed

0.1.2

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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