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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file larzhttp-0.1.0.tar.gz.
File metadata
- Download URL: larzhttp-0.1.0.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6c3b36d13976950c8c963684b46f4a85e519e9ac78d4e6e2c29905cba727d27
|
|
| MD5 |
14ceebabee0399048d29597f51e5c3ef
|
|
| BLAKE2b-256 |
5f1672fced848634f4861d73d2484a2735a5926230f470b626f5a9314e33a408
|
File details
Details for the file larzhttp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: larzhttp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
074efaa765d8cb8d30d15b3feb4ec71d069798e526bfd0a6b3911b311b6104fa
|
|
| MD5 |
b8354432a79d82afe57ce3ba65736bfc
|
|
| BLAKE2b-256 |
6baa247af08e79c7acddd4791a6ad79027119fab76eb19057141693ee66052a2
|