Metadata-Version: 2.4
Name: httpwrapper
Version: 0.1.1
Summary: A resilient HTTP client wrapper with retry and circuit breaker patterns
Author-email: HTTPWrapper Team <team@httpwrapper.com>
License: MIT License
        
        Copyright (c) 2025 Mustafa Kemal Enki
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/mkenki/HTTPWrapper
Project-URL: Documentation, https://httpwrapper.readthedocs.io/
Project-URL: Repository, https://github.com/mkenki/HTTPWrapper
Project-URL: Issues, https://github.com/mkenki/HTTPWrapper/issues
Project-URL: Changelog, https://github.com/mkenki/HTTPWrapper/blob/main/CHANGELOG.md
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.25.0
Requires-Dist: aiohttp>=3.8.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: structlog>=20.0.0
Requires-Dist: prometheus-client>=0.16.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: isort>=5.12.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Requires-Dist: flake8>=6.0.0; extra == "dev"
Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
Requires-Dist: tox>=4.0.0; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx>=5.0.0; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=1.2.0; extra == "docs"
Requires-Dist: myst-parser>=0.18.0; extra == "docs"
Dynamic: license-file

# 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

```bash
pip install httpwrapper
```

## Quick Start

```python
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

1. **HTTPClient**: Main wrapper class extending base HTTP client
2. **RetryManager**: Handles retry logic with backoff strategies
3. **CircuitBreaker**: Implements circuit breaker state management
4. **MetricsCollector**: Tracks request metrics and health
5. **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
- [x] Project structure setup
- [x] Base HTTP client implementation
- [x] Basic retry mechanism
- [x] Initial circuit breaker
- [x] Configuration system
- [x] Basic logging and metrics

### Phase 2 - Advanced Features
- [x] Exponential backoff with jitter
- [x] Custom retry conditions
- [x] Circuit breaker states (Closed, Open, Half-Open)
- [x] Async support
- [x] Connection pooling (implemented in async client)
- [x] Response caching

### Phase 3 - Production Readiness
- [x] 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](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](LICENSE) file for details.
