RequestX Documentation

PyPI version Python versions Build status Code style: black

RequestX is a high-performance HTTP client library for Python built on Rust's reqwest library using PyO3 bindings. The API is designed to be compatible with HTTPX.

Key Features

  • High Performance - Built on Rust's reqwest for speed and memory safety
  • Dual API Support - Both synchronous and async/await patterns
  • HTTPX Compatible - Familiar API for easy migration
  • Connection Pooling - Efficient connection reuse with persistent sessions
  • HTTP/2 Support - Modern protocol support out of the box
  • Streaming - Support for streaming request and response bodies
  • TLS - Secure connections via rustls

Performance

RequestX delivers significant performance improvements over traditional Python HTTP libraries:

  • 2-5x faster than requests for synchronous operations
  • 3-10x faster than aiohttp for asynchronous operations
  • Lower memory usage due to Rust's efficient memory management
  • Better connection pooling with HTTP/2 support

Quick Installation

pip install requestx

Quick Start

Synchronous API

import requestx

# Simple GET request
response = requestx.get("https://httpbin.org/json")
print(response.json())

# POST with JSON data
response = requestx.post(
    "https://httpbin.org/post",
    json={"key": "value"}
)
print(response.status_code)

Asynchronous API

import asyncio
import requestx

async def main():
    async with requestx.AsyncClient() as client:
        response = await client.get("https://httpbin.org/json")
        print(response.json())

asyncio.run(main())

Using Client Sessions

import requestx

# Connection pooling with Client
with requestx.Client(base_url="https://api.example.com") as client:
    response = client.get("/users")
    users = response.json()

Documentation Contents

Community & Support

License

RequestX is released under the MIT License. See the LICENSE file for details.