Socket
Book a DemoInstallSign in
Socket

httpwrapper

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

httpwrapper

A resilient HTTP client wrapper with retry and circuit breaker patterns

pipPyPI
Version
0.1.1
Maintainers
1

HTTPWrapper

A modern, resilient HTTP client wrapper with advanced retry mechanisms and circuit breaker pattern implementation.

Features

  • Advanced retry with exponential backoff and jitter
  • Circuit breaker pattern for fault tolerance
  • Configurable HTTP client settings
  • Comprehensive logging and metrics
  • Async/await support
  • Type hints and modern Python practices
  • Extensive test coverage
  • Docker containerization support

Installation

pip install httpwrapper

Quick Start

from httpwrapper import HTTPClient

client = HTTPClient(
    retry_config=RetryConfig(
        max_attempts=3,
        backoff_factor=0.3,
        jitter=True
    ),
    circuit_breaker_config=CircuitBreakerConfig(
        failure_threshold=5,
        recovery_timeout=60,
        expected_exception=ConnectionError
    )
)

response = client.get('https://api.example.com/data')

Architecture

Core Components

  • HTTPClient: Main wrapper class extending base HTTP client
  • RetryManager: Handles retry logic with backoff strategies
  • CircuitBreaker: Implements circuit breaker state management
  • MetricsCollector: Tracks request metrics and health
  • Configuration: Centralized configuration management

Patterns Implemented

  • Retry Pattern: Automatic retry with configurable backoff
  • Circuit Breaker: Fail-fast protection for failing services
  • Observer Pattern: Event-driven metric collection
  • Factory Pattern: Configuration-driven object creation

Development Roadmap

Phase 1 - Core Implementation

  • Project structure setup
  • Base HTTP client implementation
  • Basic retry mechanism
  • Initial circuit breaker
  • Configuration system
  • Basic logging and metrics

Phase 2 - Advanced Features

  • Exponential backoff with jitter
  • Custom retry conditions
  • Circuit breaker states (Closed, Open, Half-Open)
  • Async support
  • Connection pooling (implemented in async client)
  • Response caching

Phase 3 - Production Readiness

  • Comprehensive test suite (circuit breaker tests done)
  • Performance benchmarks
  • Docker containerization
  • CI/CD pipeline
  • Documentation
  • Health checks
  • Metrics dashboard

Phase 4 - Extensions

  • Plugin system
  • Multiple HTTP client backends
  • Rate limiting
  • Request/response interceptors
  • Custom metrics exporters

Contributing

Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.