Skip to main content

No project description provided

Project description

CIRCUIT-BREAKER-CLIENT

PyPI Python License: MIT

A lightweight Python library that provides a simple circuit breaker mechanism for HTTP clients using either requests or httpx.


✨ Features

  • Circuit breaker pattern with failure threshold and recovery timeout
  • Support for both requests and httpx
  • 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)

TestPyPI

Install from TestPyPI:

pip install --index-url https://test.pypi.org/simple/ circuit-breaker-client[requests]

📄 License

MIT © Daniel Perebinos

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

circuit_breaker_client-0.1.0.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

circuit_breaker_client-0.1.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

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

Hashes for circuit_breaker_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4bac4d0f38d9dd57c3654df3e9125ea600030d5b0da47434a8fb1a4b74d812f6
MD5 acc6ea60a1d4dc28ba7cd6b0513fc05f
BLAKE2b-256 a2d2ad2e99db8b91c55d6e08651838e57c47f0315a38143e0725991e8f3650f3

See more details on using hashes here.

File details

Details for the file circuit_breaker_client-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for circuit_breaker_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 23637d39b792aebce61636c857971f69ba08119ac76d639bc23bc1214a4c6169
MD5 870a62a44a5fb9e8859b5a81f8616a0b
BLAKE2b-256 dc80c473e3878ceaff20dac1e1587a82c7a4008f7c72b806fdc233beb9de19a3

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