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

Uploaded CPython 3.10+Windows x86-64

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

Uploaded CPython 3.10+macOS 11.0+ ARM64

servo_fetch-0.11.1-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.1.tar.gz.

File metadata

  • Download URL: servo_fetch-0.11.1.tar.gz
  • Upload date:
  • Size: 175.7 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.1.tar.gz
Algorithm Hash digest
SHA256 cc1221d75badbc15459e749d33e1dd8358b0ba0febffd6148bb91d1a5efa33c0
MD5 c4cec32f382b083d36364657b7d61ff8
BLAKE2b-256 4917e7a1691dcd6730b6af5472309e457953d46c9413a0a2cec6d7171c62f245

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: servo_fetch-0.11.1-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.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 b61be277dc359f1e52da783080d22c07f9df368df97ca0246d9496acefb8ae1c
MD5 a3835303766bffdebc4e8d3d9ba3f18c
BLAKE2b-256 657fa40f60e2a71501b69b6d8a39efdf2595041dfbd20c89fef6868f17772b26

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for servo_fetch-0.11.1-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 28aca27e98083760fe5b45ba284a6ca4575c78f8c40da9dc71d32fe29e9a067c
MD5 e14a3330dd02eef45ce81e91f893d034
BLAKE2b-256 f2d65798cb57d6e63e302e6dce3d0efc0caa6174be058bc9b95088d2a3141e76

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for servo_fetch-0.11.1-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 de809efb83fef44462fa17eab486cd8fc7662f98d21f3fd0baa7408f878583d4
MD5 6b03cd4b9e8949244946df2ee1fb527a
BLAKE2b-256 f15c04b758b67ef5e28ace9217f64847d7af6c8b7efdbf2a6a0694c8bd1c120d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for servo_fetch-0.11.1-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 35ba93d9e92c2316bc19775b4061a60bfaac3c030c3cee892d2ee389519fce4d
MD5 a71d01872d526834b155dbbb5c1de768
BLAKE2b-256 06e7343037334e2f99052e38e7aeb4f0ccf1dac77828d52bc69ea887d6946e84

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for servo_fetch-0.11.1-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1095d9eb5d8b884d9b5d9a3c02450968879a5045007dbbe889432b183326e4d9
MD5 e1eb340db8a382e28119142915d2d94f
BLAKE2b-256 fec5cc5ae5fb5f2144141eb077c956f5d46e5bd25c263ad220eb10e3ffb23c42

See more details on using hashes here.

Provenance

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