No project description provided
Project description
CIRCUIT-BREAKER-CLIENT
A lightweight Python library that provides a simple circuit breaker mechanism for HTTP clients using either
requestsorhttpx.
✨ Features
- Circuit breaker pattern with failure threshold and recovery timeout
- Support for both
requestsandhttpx - Minimal dependencies
- Easily extendable and production-ready
📦 Installation
Choose the HTTP client you want to use:
With requests:
pip install circuit-breaker-client[requests]
With httpx:
pip install circuit-breaker-client[httpx]
🚀 Usage
Using requests:
from circuit_breaker_client.requests_client import CircuitBreakerSession
client = CircuitBreakerSession(failure_threshold=3, recovery_timeout=30)
response = client.get("https://httpbin.org/status/200")
print(response.status_code)
Using httpx:
from circuit_breaker_client.httpx_client import CircuitBreakerClient
client = CircuitBreakerClient(failure_threshold=3, recovery_timeout=30)
response = client.get("https://httpbin.org/status/200")
print(response.status_code)
⚙️ Parameters
| Parameter | Description | Default |
|---|---|---|
failure_threshold |
Number of consecutive failures to open circuit | 3 |
recovery_timeout |
Seconds before retrying after circuit is opened | 30 |
📂 Project Structure
circuit-breaker-client/
├── src/
│ └── circuit_breaker_client/
│ ├── __init__.py
│ ├── requests_client.py
│ └── httpx_client.py
├── pyproject.toml
├── README.md
🧪 Development
Install with all optional dependencies:
poetry install --with requests,httpx
🧪 TestPyPI (optional)
Install from TestPyPI:
pip install --index-url https://test.pypi.org/simple/ circuit-breaker-client[requests]
📄 License
MIT © Daniel Perebinos
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 Distribution
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 circuit_breaker_client-0.1.0.tar.gz.
File metadata
- Download URL: circuit_breaker_client-0.1.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.0 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bac4d0f38d9dd57c3654df3e9125ea600030d5b0da47434a8fb1a4b74d812f6
|
|
| MD5 |
acc6ea60a1d4dc28ba7cd6b0513fc05f
|
|
| BLAKE2b-256 |
a2d2ad2e99db8b91c55d6e08651838e57c47f0315a38143e0725991e8f3650f3
|
File details
Details for the file circuit_breaker_client-0.1.0-py3-none-any.whl.
File metadata
- Download URL: circuit_breaker_client-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.0 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23637d39b792aebce61636c857971f69ba08119ac76d639bc23bc1214a4c6169
|
|
| MD5 |
870a62a44a5fb9e8859b5a81f8616a0b
|
|
| BLAKE2b-256 |
dc80c473e3878ceaff20dac1e1587a82c7a4008f7c72b806fdc233beb9de19a3
|