axios-py
A Python HTTP client inspired by Axios, featuring both synchronous and asynchronous support.
Features
- Promise-like interface with async/await support
- Unified API for sync & async requests
- Request and response interceptors
- Global & per-request configuration
- Automatic JSON parsing
- Retry mechanism with exponential backoff
- Cancelable requests
- Timeout control
- File upload/download progress tracking
- FastAPI integration
- Rate limiting support
Installation
pip install axios-py
For FastAPI support:
pip install axios-py[fastapi]
Quick Start
Basic Usage
from axios import Axios
# Create an instance
axios = Axios()
# Make a GET request
response = axios.get("https://api.example.com/data")
print(response.data)
# Make a POST request
response = axios.post(
"https://api.example.com/data",
data={"key": "value"}
)
print(response.data)
Async Usage
import asyncio
from axios import Axios
async def main():
async with Axios() as axios:
# Make async requests
response = await axios.aget("https://api.example.com/data")
print(response.data)
asyncio.run(main())
FastAPI Integration
from fastapi import FastAPI, Depends
from axios import Axios, AxiosRequestConfig
from axios.fastapi import get_axios
app = FastAPI()
# Create an Axios dependency
axios_dependency = get_axios()
@app.get("/data")
async def get_data(axios: Axios = Depends(axios_dependency)):
response = await axios.aget("https://api.example.com/data")
return response.data
Documentation
For detailed documentation, please visit the documentation site.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Release files for axios-py 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| axios_py-0.1.1.tar.gz | 6.3 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| axios_py-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.3 MB
Release files / axios_py-0.1.1.tar.gz
| Download URL | axios_py-0.1.1.tar.gz |
|---|---|
| Size | 6.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f6b9afbefe25f02b63317d6006ff5eecaee59375e5e0fdc5778e96dd34a9f13
|
|
BLAKE2b-256 checksum How to use checksums |
86c547115e8231d1cc388e8a2b7e5761eba6a1f6aab85ae79a923e90980f765d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.2
|
Release files / axios_py-0.1.1-py3-none-any.whl
| Download URL | axios_py-0.1.1-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e179b680a56a318e0dfbaad0f7a7500a2a4385296284ec549b5e2c5b4c4b6989
|
|
BLAKE2b-256 checksum How to use checksums |
8b39b78a933d381b8eb171a2267eb553b7297a1487bbfb541e36dd8a56e6ae8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.2
|