Metadata-Version: 2.3
Name: api-client-http
Version: 1.1.0
Summary: Client for sync/async query HTTP API Services
Author: Igor Voropaev
Author-email: snakework10@gmail.com
Requires-Python: >=3.11,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: httpx (>=0.28,<1.0)
Project-URL: Repository, https://github.com/apiclienthttp/apiclienthttp
Description-Content-Type: text/markdown

# API Client HTTP

Client for sync/async query HTTP API Services.
It provides a high-level interface for managing URLs, headers, and authentication.
Based on [HTTPX](https://github.com/encode/httpx) library.

## Features

- Synchronous and asynchronous HTTP requests
- Token-based authentication
- Customizable headers
- URL management
- Error handling

## Installation

To install the library, use pip:

```bash
pip install api-client-http
```

## Usage

### Synchronous client

```python
from api_client_http import RestClient
from api_client_http.auth import TokenAuth

client = RestClient(
    address="https://api.example.com/v1",
    endpoints= {
      'token': 'auth/token',
      'query': 'query/{}'
    }
)

auth_respone = client.post('token', json={'username': 'user', 'password': 'password'})
response = client.get('query', '123', auth=TokenAuth(auth_respone['access_token']))
```

### Asynchronous client

```python
from api_client_http import AsyncRestClient
from api_client_http.auth import TokenAuth

client = AsyncRestClient(
    address="https://api.example.com/v1",
    endpoints= {
      'token': 'auth/token',
      'query': 'query/{}'
    }
)

auth_respone = await client.post('token', json={'username': 'user', 'password': 'password'})
response = await client.get('query', '123', auth=TokenAuth(auth_respone['access_token']))
```

## License

This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.

## Changelog

### v1.1.0

- Updated minimal Python version to `3.11`
- Update `httpx`: `0.21` -> `0.28`
- Used `[project]` section in `pyproject.toml`
- Used `ruff` as default linter

### v1.0.0

- First app version

