Skip to content

roldriel/reqivo

Reqivo

Python PyPI Coverage Build


Modern, async-first HTTP client for Python Β· Zero external dependencies Β· Built on standard library


πŸš€ TL;DR

from reqivo import Reqivo

with Reqivo(base_url='https://api.github.com') as client:
    response = client.get('/users/octocat')
    print(response.json())

Or async:

import asyncio
from reqivo import AsyncReqivo

async def main():
    async with AsyncReqivo(base_url='https://api.github.com') as client:
        response = await client.get('/users/octocat')
        print(response.json())

asyncio.run(main())

✨ What is Reqivo?

Reqivo is a modern, async-first HTTP client library built entirely on Python's standard library. No external dependencies, pure performance.

Philosophy

Reqivo is not a requests replacement. It's a modern HTTP foundation.

Reqivo exists to bridge the gap between low-level socket/ssl usage and the need for a fast, modern HTTP client:

  • Using only the standard library (Python 3.9+)
  • Providing an async-first API with sync support
  • Supporting modern protocols (HTTP/1.1, HTTP/2, WebSockets)
  • Maintaining zero external dependencies for maximum portability

Reqivo is for:

  • Developers who want async HTTP without heavyweight dependencies
  • Teams building cloud-native applications
  • Projects where dependencies matter (embedded systems, security-critical apps)
  • Anyone seeking performance and simplicity

πŸ“¦ Installation

pip install reqivo

πŸ§ͺ Basic Example

Facade (Recommended)

from reqivo import Reqivo

def log_request(method, url, headers):
    """Hook that logs every outgoing request and passes it through."""
    print(f"-> {method} {url}")
    return method, url, headers

# Fluent API: configure base URL, auth, and hooks in one chain
client = (
    Reqivo(base_url='https://api.example.com', timeout=10)
    .bearer_token('my-token')
    .on_request(log_request)
)

response = client.get('/data')
# -> GET https://api.example.com/data
print(response.status)  # 200
print(response.json())  # {"key": "value"}
client.close()

Session (Low-level)

from reqivo import Session

with Session(base_url='https://api.example.com') as session:
    response = session.get('/data')
    session.put('/data/1', body=b'{"updated": true}')
    session.delete('/data/1')

Async Usage

import asyncio
from reqivo import AsyncReqivo

async def main():
    async with AsyncReqivo(base_url='https://api.example.com') as client:
        response = await client.get('/data')
        await client.post('/data', body=b'{"key": "value"}')
        return response.json()

asyncio.run(main())

Streaming Uploads

from reqivo import Session

def file_chunks():
    with open('large_file.bin', 'rb') as f:
        while chunk := f.read(8192):
            yield chunk

with Session() as session:
    session.post('https://upload.example.com/files', body=file_chunks())

WebSocket Support

from reqivo import Reqivo

client = Reqivo()
ws = client.websocket(
    'wss://echo.websocket.org',
    auto_reconnect=True,
    max_reconnect_attempts=5,
)
ws.connect()
ws.send('Hello WebSocket!')
message = ws.receive()
ws.close()

πŸ” Key Features

  • βœ… Zero external dependencies: Pure Python (Python 3.9+)
  • βœ… Async-first design: Built for modern async/await workflows
  • βœ… Sync support: Also works in synchronous code
  • βœ… Unified Facade: Reqivo / AsyncReqivo as single entry points with fluent API
  • βœ… Full HTTP methods: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS
  • βœ… Global config: base_url and default_timeout at session level
  • βœ… Hooks system: Pre-request and post-response interceptors (sync and async)
  • βœ… Streaming uploads: Chunked transfer encoding for iterables and file-like objects
  • βœ… HTTP/1.1 support: Full protocol implementation with automatic redirects
  • βœ… WebSocket support: Sync and async clients with auto-reconnect and configurable frame limits
  • βœ… Connection pooling: LIFO connection reuse with semaphore-based limits
  • βœ… Type hints: Fully typed following PEP 561
  • βœ… Memory efficient: Optimized with __slots__ on all core classes
  • βœ… Comprehensive testing: 97%+ test coverage

Roadmap Features

  • πŸ”„ Mutual TLS / Certificate Pinning (Planned v0.4.0)
  • πŸ”„ Structured Logging & Metrics (Planned v0.5.0)
  • πŸ”„ HTTP/2 support (Planned v1.0.0)

🧾 Comparison with other libraries

Why not requests, httpx, or aiohttp?

Feature Reqivo requests httpx aiohttp
Zero dependencies βœ… ❌ ❌ ❌
Async/await native βœ… ❌ βœ… βœ…
Sync support βœ… βœ… βœ… ❌
Request/Response hooks βœ… βœ… βœ… βœ…
Streaming uploads βœ… βœ… βœ… βœ…
WebSocket support βœ… ❌ βœ… βœ…
WebSocket auto-reconnect βœ… ❌ ❌ ❌
HTTP/2 support πŸ”„ ❌ βœ… βœ…
Connection pooling βœ… βœ… βœ… βœ…
Type hints (PEP 561) βœ… ⚠️ βœ… ⚠️
Memory optimized (__slots__) βœ… ❌ ❌ ⚠️
Coverage tested β‰₯ 97% βœ… ❓ βœ… ❓
Standard library only βœ… ❌ ❌ ❌

Note: Benchmark suite coming soon in a future release.


πŸ“š Documentation & Examples

Comprehensive examples and documentation are available in the Examples Directory:

πŸ“– Guides


πŸ”§ Development & Testing

Run Tests

# Run all tests with tox
tox

# Run specific Python version
tox -e py312

# Run with coverage
tox -e py312
coverage html && open htmlcov/index.html

πŸ“– Requirements

  • Python 3.9 or higher
  • No external dependencies for core functionality

🀝 Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.


πŸ“ License

MIT Β© 2026 β€” Rodrigo Ezequiel RoldΓ‘n
View full license


πŸ—ΊοΈ Roadmap & Changelog

About

Reqivo is a modern, async-first HTTP client library built entirely on Python's standard library. No external dependencies, pure performance.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages