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

Uploaded CPython 3.10+Windows x86-64

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

Uploaded CPython 3.10+macOS 11.0+ ARM64

servo_fetch-0.11.2-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.2.tar.gz.

File metadata

  • Download URL: servo_fetch-0.11.2.tar.gz
  • Upload date:
  • Size: 175.8 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.2.tar.gz
Algorithm Hash digest
SHA256 8453209cf9bb304fe282b2ca126dac9c999a14988e775897624b644c1bd982e1
MD5 bbf27566e9d08df1de5e7cd8c4cf9e41
BLAKE2b-256 c1167c3b2393c6011f969b820d0c8269363d4523de1174dab20c6d1ef012ab4f

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: servo_fetch-0.11.2-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.2-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 e6f1c39cba4702cd45f993916a2a4aefaeaccdd264019816c3accdf9daca39af
MD5 ac05cb853d864d344473bf7f75562e14
BLAKE2b-256 ed22e1c5846fecd0f4091bb33948e98663713e2920814a3f196e073736528ba6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for servo_fetch-0.11.2-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1f5741098ff6f45be5b7d4264c788a1afe1d6a204c385edae6679bad7d6b3b40
MD5 febe125f76e464ae934fbc2b4a12f1aa
BLAKE2b-256 363adb8a71d73550069ea3ea810e1d2de3a6c30fb4afd69e0369d22d2da269fe

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for servo_fetch-0.11.2-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5076737979c7d84f40958797b56b6db67de161d1c105587b5b0aaa7e3cd945e4
MD5 0ab455d2f70c0962c3b72ee6721a1a42
BLAKE2b-256 a73e1bd8651f2209fe61c4f471fc559062098dd04e7976a32f398a78f1d4c816

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for servo_fetch-0.11.2-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 415cc571d3329054400d9c7a6e5d1d741c4c3394599dd0f705ea4af8c205468b
MD5 786f7bd4ee7cf9bffac1b99fd4e126a8
BLAKE2b-256 d6eb94cb6882b85f70533c95a58ced2d7554eab5a1049b0f624684c197f9b04a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for servo_fetch-0.11.2-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e7481ad67489b166b7477a3cb406fc74fcdad272c39883ee719757036313ff7c
MD5 ddb00c392583c114e59700b3de1531d9
BLAKE2b-256 299b2b4a87249e9845ce760878c8b8c932055307cc657d42b6a1d81631b51901

See more details on using hashes here.

Provenance

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