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.0.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.0-cp310-abi3-win_amd64.whl (33.2 MB view details)

Uploaded CPython 3.10+Windows x86-64

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

Uploaded CPython 3.10+macOS 11.0+ ARM64

servo_fetch-0.11.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.11.0.tar.gz.

File metadata

  • Download URL: servo_fetch-0.11.0.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.0.tar.gz
Algorithm Hash digest
SHA256 233006965d405e4beb2e1c582a2283e5e3da84c9156baf73951796f17bdfb8d9
MD5 778372b565139b37fa763ce2e3e5312e
BLAKE2b-256 1d2e58d76fa69d8ef3a2fa00141a97a2cb948a37ed383275cf681dd239f16d65

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: servo_fetch-0.11.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.11.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 dc9d81457f2b6e847cf8e05744d5f4b6c8676cb84033457ce0dff63596a31688
MD5 3ba76c550b7c2793ab67579f3f70d7cb
BLAKE2b-256 0b9fb2a590daa38124d244b39519dd364265b806241f6ba13f35fb9050b93026

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for servo_fetch-0.11.0-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 11cdbe5c54e608315ad3e6562836fb575806a7d4121c4f367216bb0382602b29
MD5 2e164c8a21fd5486bde588fb6523ce06
BLAKE2b-256 5a43d3655cea27e092629e314b54d0c43c1843e93a3bd1efbce9940438b9be0f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for servo_fetch-0.11.0-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1de478615b732b466f770bfafd9876e9f1db4c1d147aa89f7691c2cfaad5756c
MD5 02e5af60cb27ca6a4f2fbc10bf950b8e
BLAKE2b-256 a94b06d69f02e697e7633c64fe9ea51e24364c588d21a6aa1d6974191d896770

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for servo_fetch-0.11.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0c1714291e649eeca35bf5e4bdba3f6507f036579e42c87f0f719ee786c02b85
MD5 20867bce42fe24ba88ed9979e9f9a2ad
BLAKE2b-256 fe92772de0720c8595bb7895b10de6398daa299dbffb6b1f674f842db23dd50d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for servo_fetch-0.11.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b7507449dd09c136828a16627b0c535b63c7d0a03976774ea346959117a87686
MD5 33aaf6ac60b3be8430cbbfad04bae978
BLAKE2b-256 4919e14688956058aa257c36d79bd887848448ee529bd5da627f849b0ba29a8e

See more details on using hashes here.

Provenance

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