Skip to main content

unblock-fetch

PyPI downloads license source

A drop-in requests.get / httpx.get that tries the request directly first and only calls AlterLab when the site refuses it: a 403 or 429, a challenge or verification page, or an empty JavaScript shell. Requests that already work never leave your machine.

Install

pip install unblock-fetch

Usage

from unblock_fetch import get

r = get("https://example.com", headers={"User-Agent": "my-app/1.0"}, timeout=20)

print(r.via)          # "direct" or "alterlab"
print(r.status_code)  # origin status code
print(r.text)         # page content

Use is_blocked(status_code, body) on its own if you only want the detection.

Parameters

Parameter Default Description
url — URL to fetch
headers None Headers for the direct request
timeout 20.0 Seconds per attempt
api_key ALTERLAB_API_KEY env Your AlterLab key for the fallback
base_url https://api.alterlab.io API base URL
client new httpx.Client Reuse your own httpx.Client

How the fallback works

  • A direct request that succeeds is returned as-is and never calls AlterLab. A plain 404 is returned as-is too.
  • With ALTERLAB_API_KEY set (or api_key=), the fallback is billed to your account, and only successful requests are charged.
  • With no key it uses a free keyless trial, capped per IP per day and by a global daily budget. Past a cap you get the original response back with get_key_url and next_action.

Get a key at alterlab.io/signup (up to 5,000 free requests).

MIT licensed.

Metadata

Release files for unblock-fetch 0.1.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 unblock-fetch 0.1.0
File Size Uploaded Provenance Actions
unblock_fetch-0.1.0.tar.gz 12.7 kB With provenance Details for unblock_fetch-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for unblock-fetch 0.1.0
File Interpreter ABI Platform Actions
unblock_fetch-0.1.0-py3-none-any.whl Python 3 none any Details for unblock_fetch-0.1.0-py3-none-any.whl

Total release size: 19.6 kB

Release files / unblock_fetch-0.1.0.tar.gz

Download URL unblock_fetch-0.1.0.tar.gz
Size 12.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3a0e5123dc41ce937f235989a93248abf278322d60df8f0ea50b07f1283f29f2
BLAKE2b-256 checksum
How to use checksums
75c131780afab0596ac7e4e5da15ffe48930cef253065a2effb3dbbe8abf3df2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 10, 2026.

Transparency log

Release files / unblock_fetch-0.1.0-py3-none-any.whl

Download URL unblock_fetch-0.1.0-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb008b74cd102c52519e8e47c9d341f0ac71b41b3b3da2a329ba3c086b0b35c0
BLAKE2b-256 checksum
How to use checksums
f83d0de07c900701c3b870a5019cafcbdc40e419a03180e9d8738a1732f4abb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 10, 2026.

Transparency log

Security for unblock-fetch 0.1.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for unblock_fetch-0.1.0.tar.gz

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 Nov 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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