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.4.tar.gz (176.2 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.4-cp310-abi3-win_amd64.whl (33.2 MB view details)

Uploaded CPython 3.10+Windows x86-64

servo_fetch-0.11.4-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.4-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.4-cp310-abi3-macosx_11_0_arm64.whl (32.1 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

servo_fetch-0.11.4-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.4.tar.gz.

File metadata

  • Download URL: servo_fetch-0.11.4.tar.gz
  • Upload date:
  • Size: 176.2 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.4.tar.gz
Algorithm Hash digest
SHA256 3bcdcb6d8a6f3eb87b57dd872faed180b79e761950123a7fef26316ac115baa0
MD5 f1266594cf2714e69c6b4c0435975d38
BLAKE2b-256 7c78dae0ba5d28056bd32743c6054ba90b40a36b7d8b7519f88684d976d79b52

See more details on using hashes here.

Provenance

The following attestation bundles were made for servo_fetch-0.11.4.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.4-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: servo_fetch-0.11.4-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.4-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 9b929d80c6cf7783f952ec6e63da547a1cbc145e95a76368bc3daf037e730ddf
MD5 4d923d75121b843dd3369b0f6a945746
BLAKE2b-256 795fc11e3288f704cf09cce8d23ae6c222bc3d2c607a44114caeb132ade78d7b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for servo_fetch-0.11.4-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d530971f63133b6de5285803ce31e07d03e7038f6af7796a9cddf360b72ba130
MD5 a99ee467111af3cff940f2f424454db6
BLAKE2b-256 09400eae1c2b8b79e09c66b8263dcbc7c728953a81b6c6bfc5aac16fdbe49aa7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for servo_fetch-0.11.4-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 98cb5120b68720d7e1ceb344ecdfe242ac761686b76f1e41ed324935a9980d35
MD5 8e46b80e38d38c6025e4120131da56e7
BLAKE2b-256 4c15d5e7dd59b691f65db6c3647e9839691643c111bf1faf2395d729eef1c083

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for servo_fetch-0.11.4-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0c1b5948a685933d342808a557cadf667f838a099630f9a6d10a0740eb463ca4
MD5 778ca0ca2e30091bd5da5267067032fc
BLAKE2b-256 2b92bb70970504e8a664432a2a82a3d9a2da99e2b7369508340d3e6a2dbf5358

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for servo_fetch-0.11.4-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 fe75bfd8d5cdfaf5f66068ef3a5f4177a910c6cf6b658609c469740a75cc0fe3
MD5 7bdc659a69513979383731d01902777b
BLAKE2b-256 bb33f55df87a1dea1991333c31637914376654c30aea02cfde1f21a263f67392

See more details on using hashes here.

Provenance

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