Skip to main content

cf-browser

Python SDK for CF Browser — read any JavaScript-rendered web page from Python.

Installation

pip install cf-browser

Usage

from cf_browser import CFBrowser

async with CFBrowser(
    base_url="https://cf-browser.YOUR-SUBDOMAIN.workers.dev",
    api_key="your-api-key",
) as browser:
    # Read a page as Markdown
    md = await browser.markdown("https://react.dev")

    # Take a screenshot
    png = await browser.screenshot("https://example.com", width=1280)

    # AI-powered data extraction
    data = await browser.json_extract(
        "https://news.ycombinator.com",
        prompt="Extract top 5 stories with title and score",
    )

    # Accessibility tree (low token cost)
    tree = await browser.a11y("https://example.com")

    # Authenticated scraping
    md = await browser.markdown(
        "https://app.example.com/dashboard",
        cookies=[{"name": "session", "value": "abc", "domain": ".example.com"}],
    )

Methods

Method Returns Description
content(url) str Rendered HTML
markdown(url) str Clean Markdown
screenshot(url) bytes PNG image
pdf(url) bytes PDF document
snapshot(url) dict HTML + metadata
scrape(url, selectors) dict Elements by CSS selector
json_extract(url, prompt) dict AI-extracted data
links(url) list[dict] All hyperlinks
a11y(url) dict Accessibility tree
crawl(url) str Async crawl job ID
crawl_status(job_id) dict Job status
crawl_wait(job_id) dict Wait for completion

All methods accept no_cache=True, cookies, and headers kwargs.

Requirements

License

MIT

Metadata

Release files for cf-browser 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cf-browser 2.0.0
File Size Uploaded
cf_browser-2.0.0.tar.gz 13.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cf-browser 2.0.0
File Interpreter ABI Platform
cf_browser-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.3 kB

Release files / cf_browser-2.0.0.tar.gz

Download URL cf_browser-2.0.0.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
21a9f1db8eeb96727d89bed8d4beff53e42742209db5c9174a204b17645a63d4
BLAKE2b-256 checksum
How to use checksums
a2133facf0bb8d24500e394c52764724bc2ad96da24996ed8e141320a9ec48cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 16, 2026.

Transparency log

Release files / cf_browser-2.0.0-py3-none-any.whl

Download URL cf_browser-2.0.0-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
211899d8342763f655caf4f5610554cad24d53f4003f90ec11df495d10a17f12
BLAKE2b-256 checksum
How to use checksums
9d8d8b480dc2d30702c36d729b4209aa5eed630c3cddfa1ace046c8d9b4943e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page