Lightweight async HTTP client with automatic retry
Project description
httplite
Lightweight async HTTP client with automatic retry on transient errors. Built on httpx and tenacity.
Installation
pip install httplite
Quick start
import asyncio
from httplite import send_request
async def main():
# Simple GET
resp = await send_request("GET", "https://httpbin.org/get")
print(resp.status_code)
print(resp.json())
# POST with JSON body
resp = await send_request("POST", "https://httpbin.org/post", json={"key": "value"})
print(resp.json())
# Custom timeout (seconds)
resp = await send_request("GET", "https://httpbin.org/delay/2", timeout=10)
asyncio.run(main())
Features
- Async-first – uses
httpx.AsyncClientunder the hood. - Automatic retry – retries up to 3 times with exponential backoff on transient connection errors (
httpx.RequestError). HTTP error status codes (4xx, 5xx) are not retried. - Configurable timeout – defaults to 30 seconds; override per request.
- Minimal API – a single
send_request()function. Any extra keyword arguments are forwarded directly tohttpx.AsyncClient.request.
API
send_request(method, url, *, timeout=30.0, **kwargs)
| Parameter | Type | Description |
|---|---|---|
method |
str |
HTTP method (GET, POST, PUT, DELETE, etc.) |
url |
str |
Target URL (must use http or https scheme) |
timeout |
float |
Request timeout in seconds (default 30.0) |
**kwargs |
Forwarded to httpx.AsyncClient.request (e.g. json, headers, params) |
Returns: httpx.Response
Raises: ValueError if the URL scheme is not http or https.
Running tests
pip install -e ".[test]"
pytest
License
MIT
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
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 httplite-1.0.0.tar.gz.
File metadata
- Download URL: httplite-1.0.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2c3a49101e578b46c93a02ed0965146dd3e14d2bcfa88a179868bc385669215
|
|
| MD5 |
e7488c0140c7ff2cda4492b6db1d0fb4
|
|
| BLAKE2b-256 |
19a185f93eb7b81aae53c410f41b2fd4622d22697981c8c9c7727f2cbe589c4a
|
Provenance
The following attestation bundles were made for httplite-1.0.0.tar.gz:
Publisher:
python-publish.yml on kejun91/httplite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
httplite-1.0.0.tar.gz -
Subject digest:
d2c3a49101e578b46c93a02ed0965146dd3e14d2bcfa88a179868bc385669215 - Sigstore transparency entry: 1131158209
- Sigstore integration time:
-
Permalink:
kejun91/httplite@76316858b9e8cbe27a808ed8cf7191a91c88448f -
Branch / Tag:
refs/heads/master - Owner: https://github.com/kejun91
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@76316858b9e8cbe27a808ed8cf7191a91c88448f -
Trigger Event:
push
-
Statement type:
File details
Details for the file httplite-1.0.0-py3-none-any.whl.
File metadata
- Download URL: httplite-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b609e298c09c865f6dac82c49224caa41d026742ac5edb5e9eb07ec7202025f
|
|
| MD5 |
dfd20edf579628a92a1f3a68bcb8a681
|
|
| BLAKE2b-256 |
d1466c763710f8c39bb5e31d50e3794e69f0a22993f7e06cb0d5dd7f78650fec
|
Provenance
The following attestation bundles were made for httplite-1.0.0-py3-none-any.whl:
Publisher:
python-publish.yml on kejun91/httplite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
httplite-1.0.0-py3-none-any.whl -
Subject digest:
0b609e298c09c865f6dac82c49224caa41d026742ac5edb5e9eb07ec7202025f - Sigstore transparency entry: 1131158520
- Sigstore integration time:
-
Permalink:
kejun91/httplite@76316858b9e8cbe27a808ed8cf7191a91c88448f -
Branch / Tag:
refs/heads/master - Owner: https://github.com/kejun91
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@76316858b9e8cbe27a808ed8cf7191a91c88448f -
Trigger Event:
push
-
Statement type: