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

Uploaded CPython 3.10+Windows x86-64

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

Uploaded CPython 3.10+macOS 11.0+ ARM64

servo_fetch-0.10.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.10.1.tar.gz.

File metadata

  • Download URL: servo_fetch-0.10.1.tar.gz
  • Upload date:
  • Size: 168.1 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.10.1.tar.gz
Algorithm Hash digest
SHA256 4fa9a8c48581f3bca3fc614552580a8442240771cbec03daa0a73580247c022f
MD5 985b63e9c21f7e4f5f5505b2e9e428a4
BLAKE2b-256 3998f8d5810739637670881337fda6626030c4435b5070effc44b76a514612cd

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: servo_fetch-0.10.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.10.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 cdd7676678e3a37825d1562717d74aa50fcba09d5002dcdbdd915abf00040172
MD5 d8fc0ee498e2ce2cba3904a8b12ad53f
BLAKE2b-256 b4a3207614b7085d3f44c37b7b2f1f70081bcdb8c472dcac52f38435d391bbad

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for servo_fetch-0.10.1-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 04859c5aac790b94babf48181c264e66039640a0ceb72ecbc61c4f98beaa71ab
MD5 70de38d22050d9c43518d3a52b2426cc
BLAKE2b-256 a29c242f20dde3dae747b8dfe3ffdc006e358a95d478dbc7a961468db57c92d4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for servo_fetch-0.10.1-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 20bd3736d79137779d8f63ed971031f75c4abdff2b3c2137c70da74121ef403e
MD5 48afe2fcf6c88646f53ee97e9a794c48
BLAKE2b-256 ad60d55fc4ac231065cf55c005a68bc1ee159dbcccd98eadddb2fa4b3ba5b794

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for servo_fetch-0.10.1-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b68f167d84807f3289b99baf9c621fa3d79dcd70bf8927e097a2d1d135c3afb8
MD5 76a43090d0c2d41bab2d5e5b36c86b56
BLAKE2b-256 3322d1b4a94aed3f18057419f98bdeb9573d323070238dcf5e8f5d0ad4cce7b2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for servo_fetch-0.10.1-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2f33623add3587a107e85c0108947ac47eb1c6a74d096d3825ae5feff47387ca
MD5 83de26cf11b8672bd457b303544b303d
BLAKE2b-256 c97561ce207dd47d96dc2ba6e95df40623f107879e1c31cb1b918a7c8e4c98c7

See more details on using hashes here.

Provenance

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