Skip to main content

Browser engine in a library — fetch, render, and extract web content.

Project description

servo-fetch

CI PyPI Python uv Ruff

Python bindings for servo-fetch — fetch, render, and extract web content with an embedded Servo browser engine.

  • No Chromium — single binary, no browser download
  • JavaScript execution — full Servo engine with SpiderMonkey
  • Schema extraction — declarative CSS-selector → structured JSON, no LLM
  • Async-readyasyncio.to_thread wrappers, AsyncClient with streaming crawl
  • Typed — full .pyi stubs, works with ty / mypy / pyright

Install

pip install servo-fetch

Quick Start

import servo_fetch
page = servo_fetch.fetch("https://example.com")
page.html          # rendered HTML
page.inner_text    # document.body.innerText
page.markdown      # readable Markdown (lazy, cached)
page.title         # str | None

Schema Extraction

from servo_fetch import Schema, Field

schema = Schema(
    base_selector=".product",
    fields=[
        Field(name="title", selector="h2", type="text"),
        Field(name="price", selector=".price", type="text"),
        Field(name="url", selector="a", type="attribute", attribute="href"),
    ],
)

page = servo_fetch.fetch("https://shop.example.com", schema=schema)
page.extracted  # [{"title": "...", "price": "...", "url": "..."}]

Async

from servo_fetch import fetch_async, AsyncClient

page = await fetch_async("https://example.com")

async with AsyncClient(user_agent="MyBot/1.0") as client:
    async for page in client.crawl_stream("https://docs.example.com", max_pages=50):
        print(page.url, page.title)

Develop

Requires uv.

uv sync --group all              # create venv + install dev deps
uv run maturin develop           # build extension (debug, fast compile)
uv run pytest                    # run tests
uv run ruff check python tests   # lint
uv run ty check python           # type check

Troubleshooting

Linux: "cannot allocate memory in static TLS block"

Servo's native extension uses large thread-local storage. On some Linux systems, set before importing:

export GLIBC_TUNABLES=glibc.rtld.optional_static_tls=16384

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

servo_fetch-0.11.3.tar.gz (175.9 kB view details)

Uploaded Source

Built Distributions

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

servo_fetch-0.11.3-cp310-abi3-win_amd64.whl (33.2 MB view details)

Uploaded CPython 3.10+Windows x86-64

servo_fetch-0.11.3-cp310-abi3-manylinux_2_28_x86_64.whl (37.5 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ x86-64

servo_fetch-0.11.3-cp310-abi3-manylinux_2_28_aarch64.whl (36.6 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

servo_fetch-0.11.3-cp310-abi3-macosx_11_0_arm64.whl (32.1 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

servo_fetch-0.11.3-cp310-abi3-macosx_10_12_x86_64.whl (33.9 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file servo_fetch-0.11.3.tar.gz.

File metadata

  • Download URL: servo_fetch-0.11.3.tar.gz
  • Upload date:
  • Size: 175.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for servo_fetch-0.11.3.tar.gz
Algorithm Hash digest
SHA256 204b5103100a9f1e609afe6e2683c4e712566b696294e0a4946790118c79d5a9
MD5 e1142d50f29916de599bbe47ae4da16a
BLAKE2b-256 03901c4a304d836b33d648111592163090e958aa7c82abf57eb6137664473423

See more details on using hashes here.

Provenance

The following attestation bundles were made for servo_fetch-0.11.3.tar.gz:

Publisher: release-python.yml on konippi/servo-fetch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file servo_fetch-0.11.3-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: servo_fetch-0.11.3-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 33.2 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for servo_fetch-0.11.3-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 dac612b0390a5f2c885cad1d3d9cf473e3d320da9704585a241c94f795c6f67c
MD5 b576f7951452d2396d6b4fd44939998c
BLAKE2b-256 3152c2e2f485857a16c35e2ec9cbde65c2439b0c90ec462a7d1e12af51ba7ca8

See more details on using hashes here.

Provenance

The following attestation bundles were made for servo_fetch-0.11.3-cp310-abi3-win_amd64.whl:

Publisher: release-python.yml on konippi/servo-fetch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file servo_fetch-0.11.3-cp310-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for servo_fetch-0.11.3-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 805103948c1e96d375862a10afa8a14a210c8a02fde7f2820492e307c24acd60
MD5 c9851547c2443d0601c2089284d8cd85
BLAKE2b-256 fe96ae9c9bdcb63f83c91347f8fba1c30101b27a18fc9a57e0755b60c44346dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for servo_fetch-0.11.3-cp310-abi3-manylinux_2_28_x86_64.whl:

Publisher: release-python.yml on konippi/servo-fetch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file servo_fetch-0.11.3-cp310-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for servo_fetch-0.11.3-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 dfffb83c446aa191b2f5aec59921fec0a9efc95c83e0f68bebdd53a9c48a8b40
MD5 c32e13c989f0040721dd2fe8e3a4d5ca
BLAKE2b-256 bff2952a44aa2adf0e26c48c183f8885fa2a8055c913c4dc6d586ae4ce1ad637

See more details on using hashes here.

Provenance

The following attestation bundles were made for servo_fetch-0.11.3-cp310-abi3-manylinux_2_28_aarch64.whl:

Publisher: release-python.yml on konippi/servo-fetch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file servo_fetch-0.11.3-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for servo_fetch-0.11.3-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3c00e1070b18d254ca0dc603921ad1d2caa14ed417dbd142983edf9708c6458e
MD5 a452ff3526f5aa7df463d8636172541f
BLAKE2b-256 b65d25f241d2e8e649c4b02c47c937ea5d59968dcff58775ee01f565e0c84c1f

See more details on using hashes here.

Provenance

The following attestation bundles were made for servo_fetch-0.11.3-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: release-python.yml on konippi/servo-fetch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file servo_fetch-0.11.3-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for servo_fetch-0.11.3-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 96c5d058129eb4fdd235e17010ac16c196272a4f048878838480d826319a8ddf
MD5 7fc66dbd5fa616a5e95d68007d7eab5a
BLAKE2b-256 165765da738360fc85e13421fd35a76fbfb8f37e9a5a064c5fe938114684a88a

See more details on using hashes here.

Provenance

The following attestation bundles were made for servo_fetch-0.11.3-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: release-python.yml on konippi/servo-fetch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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