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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

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

Uploaded CPython 3.10+Windows x86-64

servo_fetch-0.10.0-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.10.0-cp310-abi3-manylinux_2_28_aarch64.whl (36.6 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.10+macOS 11.0+ ARM64

servo_fetch-0.10.0-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.10.0-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: servo_fetch-0.10.0-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.10.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d9afbfd6d87797d7f17ba0aa87a7ceb7d9256183ba3908ecc00be9c7509fae1e
MD5 104702fb392d99ac6b99846cd359f0ce
BLAKE2b-256 e46e5e506175cbf12215fa9aceea6ec99b2e5224dd2de3da523034c6daf510c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for servo_fetch-0.10.0-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.10.0-cp310-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for servo_fetch-0.10.0-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9738e4c33a0a582439516cb2f45e9aab56589342d897288ecf29e5807a82dbdd
MD5 18772387079eaeccfabaab81e8d577b4
BLAKE2b-256 d43d6bf56451d48384b98f5e8e3c3608950348fe08bf897f824f8a6011d4cbb4

See more details on using hashes here.

Provenance

The following attestation bundles were made for servo_fetch-0.10.0-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.10.0-cp310-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for servo_fetch-0.10.0-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b7f1def96bf5b6c41a5d952736d140e2e37ba555af10972688b68f9826913ceb
MD5 57223385ec1bb32d79844a1dd7f8d4a1
BLAKE2b-256 a8c521618897138a4bbb8b69d8d6beccc3da7219352803c88ad1ef59128d4629

See more details on using hashes here.

Provenance

The following attestation bundles were made for servo_fetch-0.10.0-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.10.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for servo_fetch-0.10.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 501816b552450a48e02cc374fe2ac6c470d6f9b6b9141df763ebbda267fa36b7
MD5 97124337087aca7a3934099bf931a766
BLAKE2b-256 9df95916165d223893e8bfe294b423e181b35224273285b9c2bda1b3beff34a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for servo_fetch-0.10.0-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.10.0-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for servo_fetch-0.10.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6a6ded3c6548a3b71b78b978509bf8919b8a0ba34e10c2fe136e55cc74388f44
MD5 e36ee6f529ba9a7cad5fe1e860beab97
BLAKE2b-256 2166272dc562e88d5601ad7a1376959608faac724a662ef29da12517f90090bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for servo_fetch-0.10.0-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