Metadata-Version: 2.4
Name: lightreq
Version: 0.2.0
Summary: Lightweight, hackable HTTP client with adapter switching and middleware
Author-email: Ryan Febriansyah <ryanfebriansyah72@gmail.com>
License: BSD
Keywords: http,client,requests,httpx,middleware,testing
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: BSD License
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: requests
Requires-Dist: requests>=2.25.0; extra == "requests"
Provides-Extra: httpx
Requires-Dist: httpx>=0.24.0; extra == "httpx"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Dynamic: license-file

# lightreq

![pipeline](https://gitlab.com/ryaneatfood/lightreq/badges/master/pipeline.svg) ![coverage](https://gitlab.com/ryaneatfood/lightreq/badges/master/coverage.svg)

A lightweight, composable HTTP client for Python built around the chain-of-responsibility pattern

## Installation

```bash
pip install lightreq
```

## Usage

```python
from src.client import HttpClient
from src.middleware import logging, retry

client = HttpClient(
    adapter="requests",
    middleware=[logging(), retry(retries=3)]
)

response = client.get(url="https://jsonplaceholder.typicode.com/todos/1")
print(response.is_ok())     # True
print(response.json())      # {'userId': 1, 'id': 1, ...}

client.close()
```

## Documentation

Full documentation is available at [lightreq.readthedocs.io](https://lightreq.readthedocs.io)
