careful
careful is a Python library for writing resilient, well-behaved HTTP clients.
Code: https://codeberg.org/jpt/careful
Docs: https://jpt.sh/projects/careful/
Call one function to enchant an httpx2.Client, making your HTTP connections more resilient and better mannered.
- Configure throttling to avoid accidental Denial-of-Service / risking getting banned.
- Retries help overcome intermittent failures on flaky sites or long crawls.
- Development caching Cache persists between runs during development, reduces redundant requests made while iterating on your crawlers & scrapers.
Example
from httpx2 import Client
from careful.httpx import make_careful_client
# the only function you need to call is make_careful_client
# this wraps your existing `httpx2.Client` with your preferred
# careful behaviors
client = make_careful_client(
client=Client(headers={'user-agent': 'spiderman/1.0'}),
# retries are configurable w/ exponential back off
retry_attempts=2,
retry_wait_seconds=5,
# can cache to process memory, filesystem, or SQLite
cache_storage=MemoryCache(),
# easy-to-configure throttling
requests_per_minute=60,
)
# methods on client are called as they always are
# configured behaviors occur without further code changes
client.get("https://example.com")
Logo licensed from Adrien Coquet via Noun Project
Metadata
Release files for careful 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| careful-0.5.0.tar.gz | 18.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| careful-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.0 kB
Release files / careful-0.5.0.tar.gz
| Download URL | careful-0.5.0.tar.gz |
|---|---|
| Size | 18.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
30ba4596a84c03dea5ef9731b013eacb9f262f176655841225c93dea214d153a
|
|
BLAKE2b-256 checksum How to use checksums |
cb01eef552a8f04505927c8ebc3f542a88b2c074fd4aad025c282b8b0785538e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"25.11","id":"xantusia","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / careful-0.5.0-py3-none-any.whl
| Download URL | careful-0.5.0-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c854f5a03f0d45efb88e6b61d8bba9e097f40996eb385e40d37ade900a010733
|
|
BLAKE2b-256 checksum How to use checksums |
793a75b2d06b449d8618bced4c690cee9e2cca26c4ca2a94afa998d0baf4a5fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"25.11","id":"xantusia","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|