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

Uploaded CPython 3.10+Windows x86-64

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

Uploaded CPython 3.10+macOS 11.0+ ARM64

servo_fetch-0.12.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.12.0.tar.gz.

File metadata

  • Download URL: servo_fetch-0.12.0.tar.gz
  • Upload date:
  • Size: 181.5 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.12.0.tar.gz
Algorithm Hash digest
SHA256 88b993bc087316353598f8403cbdfb84bb37b8d83d1c861f2b6b79730f7bee0a
MD5 572e2ca79a19ba63f2a6ccb5ed2d08c4
BLAKE2b-256 f0eecfa6e237cb1c7ca6496b4c9d2c826daa4f75f73a39d3a8785a2758500ef8

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: servo_fetch-0.12.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.12.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c2fce73404742be67f786c58340d56ea23126fa4c1c50131cb2e1fbd1a8c510c
MD5 8b15561e6e8ab96d6c0c6322ffe00acf
BLAKE2b-256 95f9bb5378c499fb57a8d00b3bb88a1d46832c1c8131916a0c6ff97307119546

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for servo_fetch-0.12.0-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 013da4155943ccb7a42015680119d7554015896c7677fe77daf20850920a5959
MD5 e0c723d55454b818b8ac9047f8df613b
BLAKE2b-256 2a408b94a3b227f0753bcf7a473aa5022afed1bfe038559b1f1054edb5b04657

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for servo_fetch-0.12.0-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9da2e7044b5400700eddaad5e8c2e4c433a6e58203a7800c929a1ab87f789004
MD5 a99ab596c63ba3893357de5a85aa4882
BLAKE2b-256 fc32e07576e1f2252a820846d61f4bc342e311289702b5f5ae6d012634ddafa6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for servo_fetch-0.12.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eff58868dedeeb667a8c5c4ddf2a324a10d0c50637d625c7aedc930c6781d647
MD5 a820e69e41ac5dda37dc5386576e32c1
BLAKE2b-256 1d4380ad6205e441835a062685cb553ea6f2f13542a260526709328da71d8c93

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for servo_fetch-0.12.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 21b6289413971f585bc1a34ec4e887523aa7620e7a4354fdacd4376eb915eae0
MD5 5322a9edca72a664ffaf29034e87719e
BLAKE2b-256 83d0d308d2f2ee6cb2896a3b654b3ec2465c230c906ddc326b367622700ea54b

See more details on using hashes here.

Provenance

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