Skip to main content

webfetch-io

Official Python client for the webfetch.io scraping API. Python 3.9+, sync and async, one dependency (httpx).

pip install webfetch-io

Use

from webfetch import WebfetchClient

client = WebfetchClient("wfk_...")          # required; free key at webfetch.io/signup

md = client.markdown("https://example.com")

data = client.extract("https://quotes.toscrape.com/js/", {
    "quotes": {
        "selector": ".quote",
        "type": "list",
        "output": {"text": ".text", "author": ".author"},
    },
})

result = client.fetch("https://example.com", render_js=False, block_ads=True)
print(result.status, result.credits, result.resolved_url)

Async is the same surface, awaited:

from webfetch import AsyncWebfetchClient

async with AsyncWebfetchClient("wfk_...") as client:
    result = await client.fetch("https://example.com", render_js=False)

Errors

from webfetch import WebfetchApiError, WebfetchRateLimitError

try:
    client.fetch(url)
except WebfetchRateLimitError as e:
    time.sleep(e.retry_after or 5)
except WebfetchApiError as e:
    print(e.status, e.code)      # e.code is stable and safe to branch on

A failed call is never billed.

Credits

render_js defaults to True, which costs 5 credits. Pass render_js=False for a plain HTTP fetch at 1 credit. result.credits reports what was charged.

MIT licensed. Full reference at https://webfetch.io/documentation.

Metadata

Release files for webfetch-io 1.0.0

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

Source distribution (sdist)

Source distribution for webfetch-io 1.0.0
File Size Uploaded
webfetch_io-1.0.0.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for webfetch-io 1.0.0
File Interpreter ABI Platform
webfetch_io-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.8 kB

Release files / webfetch_io-1.0.0.tar.gz

Download URL webfetch_io-1.0.0.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
71b95b5bf16c4bc52c95b544e9b1245d502cf8d12947cb876344d8e1edfc0c65
BLAKE2b-256 checksum
How to use checksums
ee4b92f5403829d82947a105c73b4a63757fb42132c8b10eb5eb1d3cdc63b949
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.2

Release files / webfetch_io-1.0.0-py3-none-any.whl

Download URL webfetch_io-1.0.0-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
825ed7ca6fb72f97339137a025589e4d44723612b3825b768d86ce60aa777b2a
BLAKE2b-256 checksum
How to use checksums
ee8e8d9747af2d3852b54c45acf635964e20cd0e9d9f4272a6b7e3e7bcb66ae1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.2

Release history Release notifications | RSS feed

This release

1.0.0 This release

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