⚡ mini-aiohttp
mini-aiohttp v0.3.0 is a lightweight, asynchronous HTTP/1.1 client and server framework built with Python and asyncio.
Designed for simplicity, performance, flexibility and security, with zero mandatory third-party runtime dependencies.
✨ Features
HTTP Client
-
Asynchronous HTTP/1.1 requests.
-
Connection pooling and keep-alive.
-
Per-host concurrency limits.
-
Automatic redirect handling.
-
Bounded retries for idempotent methods.
-
Cookie management.
-
Streaming response downloads.
-
Async streaming uploads.
-
Multipart form and file uploads.
-
HTTP and SOCKS5/SOCKS5h proxies, including HTTPS CONNECT/tunnelling.
-
DNS caching.
-
Configurable connection and request timeouts.
-
TLS context customization.
-
Request and response hooks.
-
Response size limits.
-
Standalone WebSocket client and server (
ws:///wss://). -
Automatic HTTPS client: ALPN selects HTTP/2 when available, otherwise HTTP/1.1; Alt-Svc enables HTTP/3 on subsequent requests (
AutoClientSession). -
Optional HTTP/2 client/server adapters using ALPN (
pip install mini-aiohttp[http2]). -
Optional HTTP/3 client/server adapters using QUIC (
pip install mini-aiohttp[http3]).
HTTP Server
- Asynchronous HTTP server.
- Custom routing and path parameters.
- Middleware support.
- HTTP/1.1 persistent connections.
- Chunked request-body decoding.
- Chunked streaming responses.
- HTTPS support using SSLContext.
- Static file serving.
- Path traversal protection.
- Graceful server shutdown.
- Connection limits.
- Runtime server statistics.
Security
- HTTP header validation.
- Request framing validation.
- Content-Length and Transfer-Encoding conflict protection.
- CORS middleware.
- Security headers.
- Token-bucket rate limiting.
- IP/CIDR policies.
- Secure cookie helpers.
- JSON request validation.
- Bounded request and response parsing.
📦 Installation
Install the latest stable release:
pip install mini-aiohttp
Install optional protocol support:
pip install "mini-aiohttp[http2,http3]"
Install a specific version:
pip install mini-aiohttp==0.3.0
Upgrade an existing installation:
pip install --upgrade mini-aiohttp
Verify installation:
pip show mini-aiohttp
🚀 Quick Start
Create an HTTP Server
import asyncio
from mini_aiohttp import Server, Response
app = Server()
@app.route("/")
async def home(req):
return Response.json({
"message": "Welcome to mini-aiohttp",
"version": "0.3.0"
})
@app.route("/hello/{name}")
async def hello(req):
return Response.json({
"hello": req.params["name"]
})
async def main():
await app.start("127.0.0.1", 8080)
try:
await asyncio.Event().wait()
finally:
await app.close()
asyncio.run(main())
HTTP Client
import asyncio
from mini_aiohttp import ClientSession
async def main():
async with ClientSession() as session:
response = await session.get(
"https://example.com"
)
print("Status:", response.status)
print("Body:", response.text)
asyncio.run(main())
🌊 Streaming Responses
Create asynchronous chunked responses without buffering the complete response body.
import asyncio
from mini_aiohttp import Server, Response
app = Server()
@app.route("/stream")
async def stream(req):
async def generate():
for i in range(5):
yield f"Message {i}\\n"
await asyncio.sleep(1)
return Response.stream(
generate(),
headers={
"Content-Type": "text/plain"
}
)
asyncio.run(
app.serve_forever("127.0.0.1", 8080)
)
Supports HTTP/1.1 chunked response transfer.
📊 Server Statistics
Monitor basic server activity:
print(app.stats)
Example output:
{
"active_connections": 0,
"total_connections": 1,
"total_requests": 2,
"status_counts": {
200: 1,
404: 1
},
"uptime_requests_per_connection": 2.0
}
Statistics are process-local and represent basic runtime counters.
🧪 Testing
Clone the repository:
git clone https://github.com/hostunio16-ops/mini-aiohttp.git
cd mini-aiohttp
Install development dependencies:
pip install -e ".[test]"
Run tests:
python -m pytest -v
Build distributions:
pip install build twine
python -m build
python -m twine check dist/*
⚙️ Compatibility
| Component | Support |
|---|---|
| Python | 3.9+ |
| HTTP/1.1 | Yes |
| HTTPS Server | Yes |
| Chunked Requests | Yes |
| Streaming Responses | Yes |
| SOCKS5 | Yes, HTTP targets |
| HTTP/2 | Optional adapters (HTTP2Client, HTTP2Server) |
| HTTP/3 | Optional adapters (HTTP3Client, HTTP3Server) |
| WebSockets | Standalone RFC 6455 client/server |
🛡️ Protocol Limitations
- HTTP/2 and HTTP/3 are optional adapters and require their respective extras.
- HTTP/2 requires TLS ALPN negotiation; the adapter currently uses one request per connection.
- HTTP/3 requires QUIC/UDP, TLS 1.3 certificates and an HTTP/3-capable endpoint; it cannot be transparently substituted on arbitrary TCP connections.
- WebSocket support is standalone and is not mounted as a route on the HTTP/1.1
Serverclass. - HTTPS proxy tunnels require a CONNECT-capable HTTP proxy or SOCKS5 proxy.
- Streaming responses require asynchronous iterables.
- No automatic multi-process worker manager is included.
📚 Links
- GitHub Repository: https://github.com/hostunio16-ops/mini-aiohttp
- Latest Release: https://github.com/hostunio16-ops/mini-aiohttp/releases/tag/v0.3.0
- PyPI Package: https://pypi.org/project/mini-aiohttp/
- GitHub Actions: https://github.com/hostunio16-ops/mini-aiohttp/actions
📄 License
This project is licensed under the MIT License.
mini-aiohttp v0.3.0
Lightweight. Asynchronous. Flexible.
Metadata
Release files for mini-aiohttp 0.3.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 | Actions |
|---|---|---|---|---|
| mini_aiohttp-0.3.0.tar.gz | 46.0 kB | With provenance | Details for mini_aiohttp-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mini_aiohttp-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for mini_aiohttp-0.3.0-py3-none-any.whl |
Total release size: 85.2 kB
Release files / mini_aiohttp-0.3.0.tar.gz
| Download URL | mini_aiohttp-0.3.0.tar.gz |
|---|---|
| Size | 46.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e6df9e56af9bd556b9878e3718341c5904c285a9e0aec19280f42363a8c83780
|
|
BLAKE2b-256 checksum How to use checksums |
e8ff088f5647f2581d941d305337649c781202b01003e2cce9bf1e12a254d616
|
| 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 16, 2026.
Transparency logRelease files / mini_aiohttp-0.3.0-py3-none-any.whl
| Download URL | mini_aiohttp-0.3.0-py3-none-any.whl |
|---|---|
| Size | 39.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3f23f706c01046a7568f3c3dea1caccf7b4cab469db69a6d6cc69afc20b7fee6
|
|
BLAKE2b-256 checksum How to use checksums |
895bb6d04567942aff64b5c71bebfb269c4cb8d2642182cf1a2264768fd58fd1
|
| 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 16, 2026.
Transparency logSecurity for mini-aiohttp 0.3.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.
Attestation for mini_aiohttp-0.3.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 16, 2026.
Transparency logA 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.