larzhttp
An ergonomic HTTP client in pure Python. Zero dependencies.
The requests-style API everyone already knows — backed by the standard library
instead of a dependency tree.
import larzhttp
r = larzhttp.get("https://api.example.com/items", params={"page": 2}, timeout=10)
r.status_code # 200
r.ok # True
r.json() # parsed body
larzhttp.post(url, json={"name": "Ada"}, headers={"X-Key": "..."}).raise_for_status()
Why
- Zero dependencies. It's
urllibunder the hood — nothing to install, no transitive supply chain, runs anywhere Python does. Perfect when you don't want to pullrequests(and its deps) into a small tool, a lambda, or a locked-down environment. - Familiar API.
get/post/put/patch/delete/head,params=,json=,data=,headers=,auth=,timeout=— the shapes you already use. - The conveniences that matter. JSON in and out, automatic gzip/deflate decoding, basic auth, cookie-persisting sessions, and retries with exponential backoff on connection errors and 5xx.
- Real responses.
.status_code,.ok,.text,.content,.json(),.headers,.url, and.raise_for_status().
Install
pip install larzhttp
Usage
import larzhttp
# query params & JSON
larzhttp.get(url, params={"q": "hello", "page": 2})
larzhttp.post(url, json={"name": "Ada"})
larzhttp.post(url, data={"form": "field"}) # url-encoded form
# auth, headers, timeout
larzhttp.get(url, auth=("user", "pass"), headers={"X-Key": "k"}, timeout=5)
# handle errors
r = larzhttp.get(url)
r.raise_for_status() # raises HTTPError on 4xx/5xx
Sessions
A Session reuses headers, cookies, a base URL, and retry settings across
requests:
from larzhttp import Session
with Session(base_url="https://api.example.com",
headers={"Authorization": "Bearer TOKEN"},
retries=3) as s:
me = s.get("/me").raise_for_status().json()
s.post("/events", json={"type": "login"})
Retries & timeouts
larzhttp.get(url, retries=3) # backs off on connection errors and 5xx
larzhttp.get(url, timeout=2) # raises Timeout if exceeded
Exceptions: HTTPError (from raise_for_status), ConnectionError, Timeout.
Scope
larzhttp covers the everyday HTTP-client surface with zero dependencies. It's not (yet) an async client, and it doesn't do HTTP/2 or connection pooling like the big libraries — if you need those, reach for httpx. For scripts, SDKs, webhooks, API calls, and services that value a tiny footprint, this is all you need.
Tests
python -m unittest discover -s tests -v # 21 tests against a live localhost server
The Larz stack
Pure-Python, zero-dependency building blocks:
- larz — money-native web framework
- larzchain — from-scratch PoW blockchain
- larzmoney — exact, penny-perfect money
- larzcrypt — pure-Python cryptography toolkit
- larzdb — crash-safe embedded database
- larzagent — zero-dep AI agent framework
- larzchart — data to inline SVG charts
- larzmark — Markdown + SEO static sites
- larztask — durable background job queue
- larzvault — encrypted secrets manager
- larzvm — deterministic gas-metered VM
- larzcache — LRU/TTL/tiered caching
- larzvalidate — schema validation
- larzid — decentralized identity
- larzrpc — JSON-RPC over HTTP
- larzstate — durable workflows & state machines
- larzhttp — this library
License
MIT © larz-scripter
Metadata
Release files for larzhttp 0.1.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 | Provenance | |
|---|---|---|---|---|
| larzhttp-0.1.0.tar.gz | 10.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| larzhttp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.6 kB
Release files / larzhttp-0.1.0.tar.gz
| Download URL | larzhttp-0.1.0.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d6c3b36d13976950c8c963684b46f4a85e519e9ac78d4e6e2c29905cba727d27
|
|
BLAKE2b-256 checksum How to use checksums |
5f1672fced848634f4861d73d2484a2735a5926230f470b626f5a9314e33a408
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / larzhttp-0.1.0-py3-none-any.whl
| Download URL | larzhttp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
074efaa765d8cb8d30d15b3feb4ec71d069798e526bfd0a6b3911b311b6104fa
|
|
BLAKE2b-256 checksum How to use checksums |
6baa247af08e79c7acddd4791a6ad79027119fab76eb19057141693ee66052a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Security for larzhttp 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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.