A fast HTTP client library for Python powered by Rust
Project description
🚀 pikahttp
A blazingly fast HTTP client for Python, powered by Rust and Hyper.
pikahttp combines Python's ease of use with Rust's performance, providing a simple yet powerful HTTP client that's up to 18% faster than traditional Python HTTP libraries.
📖 Documentation Languages
- MORE DETAILED ENGLISH README - Comprehensive English documentation
- Bengali README - Complete Bengali (Bangla) documentation
✨ Features
- ⚡ Fast: Built with Rust and Hyper for maximum performance
- 🔄 Simple: Clean, intuitive Python API
- 🛡️ Reliable: Battle-tested Rust libraries under the hood
- 💾 Efficient: Minimal memory allocations and zero-copy operations
- 🔒 Safe: Thread-safe and memory-safe by design
- 🚀 Async-first: Fully asynchronous HTTP requests
🔧 Installation
pip install pikahttp
From Source
git clone https://github.com/GrandmaEJ/pikahttp.git
cd pikahttp
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r requirements-dev.txt
pip install maturin
maturin develop
🚀 Quick Start
Using Session
from pikahttp import Session
import json
# Create a session
session = Session()
# GET request
response = session.request(
"GET",
"https://httpbin.org/get",
headers={"User-Agent": "pikahttp/0.1.0"}
)
print(f"Status code: {response['status_code']}")
print(f"Content: {response['content']}")
# POST request with JSON
data = {"hello": "world"}
response = session.request(
"POST",
"https://httpbin.org/post",
headers={
"User-Agent": "pikahttp/0.1.0",
"Content-Type": "application/json"
},
body=json.dumps(data)
)
print(f"Status code: {response['status_code']}")
print(f"Response: {response['content']}")
Using Convenience Functions
from pikahttp import Session
# Create a session
session = Session()
# GET request
response = session.get("https://api.github.com/zen")
print(f"Status: {response['status_code']}")
print(f"Headers: {response['headers']}")
# POST request
response = session.post(
"https://httpbin.org/post",
headers={"Content-Type": "application/json"},
body='{"key": "value"}'
)
print(f"Response: {response['content']}")
⚡ Performance
Based on benchmarks with 100 requests each:
| Library | Mean (s) | Median (s) | Min (s) | Max (s) | StdDev (s) |
|---|---|---|---|---|---|
| urllib | 0.2389 | 0.2351 | 0.2291 | 0.6488 | 0.0415 |
| requests | 0.2590 | 0.2575 | 0.2524 | 0.3014 | 0.0071 |
| pikahttp | 0.2193 | 0.2202 | 0.2162 | 0.2252 | 0.0021 |
- 🚀 18.1% faster than
requests - 🎯 8.9% faster than
urllib - 📊 More consistent performance (lower standard deviation)
🛠️ Development
Running Tests
python -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt
pytest tests/
Running Benchmarks
python benchmark.py
🔒 Security & Features
- Async-first design powered by Rust and Tokio
- HTTP/2 support
- Cookie handling
- Custom headers, query parameters, and JSON/form support
- Proper error handling and timeout configuration
- Session support
📖 Documentation
- English Documentation - Comprehensive guide in English
- Bengali Documentation - Complete guide in Bengali/Bangla
- Examples
- API Reference
📝 License
MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
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 pikahttp-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: pikahttp-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 3.1 MB
- Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be8e4db1e9958e201b7fbb8d6690e506f5836a94f9840de75c6e719910e5a978
|
|
| MD5 |
218b84010a6192f669b50a07693d6a2d
|
|
| BLAKE2b-256 |
592c4de721a5c97893522b6ac6a72fa431082f03528fea26afa90372c4bfff0f
|