Skip to main content

Python HTTP client inspired by Axios

Project description

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.

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

axios_py-0.1.1.tar.gz (6.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

axios_py-0.1.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file axios_py-0.1.1.tar.gz.

File metadata

  • Download URL: axios_py-0.1.1.tar.gz
  • Upload date:
  • Size: 6.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for axios_py-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9f6b9afbefe25f02b63317d6006ff5eecaee59375e5e0fdc5778e96dd34a9f13
MD5 f096a4259d850c64f2f2ee6619260f30
BLAKE2b-256 86c547115e8231d1cc388e8a2b7e5761eba6a1f6aab85ae79a923e90980f765d

See more details on using hashes here.

File details

Details for the file axios_py-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: axios_py-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for axios_py-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e179b680a56a318e0dfbaad0f7a7500a2a4385296284ec549b5e2c5b4c4b6989
MD5 a603c0f73868d9d88398ffffb71fbd9c
BLAKE2b-256 8b39b78a933d381b8eb171a2267eb553b7297a1487bbfb541e36dd8a56e6ae8d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page