Skip to main content

JS-aware HTML fetcher for Analog that probes-then-renders only when needed. Uses Playwright.

Reason this release was yanked:

Merged into analog-sdk; install analog-sdk instead.

Project description

analog-fetcher

JS-aware fetching for Analog. Two fetchers, both implementing the analog.fetcher.Fetcher protocol:

  • AnalogFetcher — the recommended default. Does a cheap HTTP fetch first, analyzes the HTML to decide if rendering is actually needed, and only escalates to a real browser when it is. Caches the decision per-domain so subsequent fetches skip the probe.
  • PlaywrightFetcher — direct Playwright access. Use when you know you want JS rendering on every fetch and don't want the probe overhead.

When analog-fetcher is installed alongside analog-sdk, AnalogFetcher becomes the SDK's default automatically — no code change required on the caller side.

Installation

pip install "analog-sdk[fetcher]"   # installs analog-sdk + analog-fetcher
# or
pip install analog-fetcher           # standalone (pulls analog-sdk too)

Then install the browser binaries Playwright uses:

playwright install chromium

Usage

The simplest path — let the SDK use the smart default:

from analog import analog

# AnalogFetcher is the default when analog-fetcher is installed.
result = analog("https://example.com")

Or construct one explicitly with custom behavior:

from analog import analog
from analog_fetcher import AnalogFetcher, PlaywrightFetcher

# Customize the rich fetcher used during escalation.
fetcher = AnalogFetcher(
    rich=PlaywrightFetcher(wait_for=".loaded", headless=True),
)
result = analog("https://example.com", fetcher=fetcher)

Or force Playwright on every fetch:

from analog_fetcher import PlaywrightFetcher

with PlaywrightFetcher(headless=True) as fetcher:
    r1 = analog("https://example.com/a", fetcher=fetcher)
    r2 = analog("https://example.com/b", fetcher=fetcher)
    # Browser launches once, is reused across both fetches.

Decision cache

AnalogFetcher records each domain's "needs JS?" verdict on disk so repeat fetches skip the probe. The cache lives under your per-user cache directory:

  • Linux: ~/.cache/analog/fetch_decisions.json (or $XDG_CACHE_HOME/analog/…)
  • macOS: ~/Library/Caches/analog/fetch_decisions.json

Set ANALOG_CACHE_DIR to relocate it, or pass cache_path= to AnalogFetcher. Verdicts expire after 7 days; pass cache_ttl_seconds=0 to re-probe on every fetch, or delete the file to reset sooner.

See https://getanalog.io for full documentation.

License

MIT — see LICENSE.

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

analog_fetcher-0.3.1.tar.gz (34.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

analog_fetcher-0.3.1-py3-none-any.whl (28.0 kB view details)

Uploaded Python 3

File details

Details for the file analog_fetcher-0.3.1.tar.gz.

File metadata

  • Download URL: analog_fetcher-0.3.1.tar.gz
  • Upload date:
  • Size: 34.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for analog_fetcher-0.3.1.tar.gz
Algorithm Hash digest
SHA256 3c5f5710fd27a08d0cf7a93e33fd5acdea08fa03c5bc1871f943f6718c8eb755
MD5 6fee1134b675a8e43893c0e077c822ca
BLAKE2b-256 78196c2e4e9a374a2ebccc2b59f43999d30707575955226f420091cd74d05c0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for analog_fetcher-0.3.1.tar.gz:

Publisher: release-fetcher-python.yml on getanalog/monorepo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file analog_fetcher-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: analog_fetcher-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 28.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for analog_fetcher-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b231caf9110f5c3fe883f348cc79dbf7b2a89fe5f522303d4f1e05263cf9924e
MD5 5f75df6813211be1f5b093e8160badf2
BLAKE2b-256 1f7a48c7f3608134b8146ecf716699faf1ebd4d1eb01e709c4a6ff26e37a6a90

See more details on using hashes here.

Provenance

The following attestation bundles were made for analog_fetcher-0.3.1-py3-none-any.whl:

Publisher: release-fetcher-python.yml on getanalog/monorepo

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