feat: Add Booklooker client configuration and exception handling

- Introduced BooklookerConfig class for runtime configuration management.
- Created custom exceptions for API errors, including authentication and validation errors.
- Generated API contracts from OpenAPI specification, including endpoints and security schemes.
- Implemented models for articles, orders, and webhooks to facilitate data handling.
- Developed a webhook helper for processing and enriching webhook events.
- Added tests for configuration defaults, token expiration, and webhook enrichment.
This commit is contained in:
claudi 2026-04-16 14:42:19 +02:00
commit 1d8ee1bba6
21 changed files with 3009 additions and 0 deletions

36
README.md Normal file
View file

@ -0,0 +1,36 @@
# booklooker-client
A Python client for the Booklooker REST API designed for middleware and connector-hub scenarios.
## Highlights
- Generated API contract derived from [openapi.yaml](openapi.yaml)
- Sync and async client entrypoints
- Pydantic models for normalized responses
- Token auto-refresh handling
- Webhook helper toolbox for Push-API style events
- FastAPI example receiver and enrichment workflow
## Installation
```bash
pip install -e .[dev,webhooks]
```
## Quick start
```python
from booklooker_client import BooklookerConfig, SyncBooklookerClient
config = BooklookerConfig(api_key="YOUR_API_KEY")
client = SyncBooklookerClient(config)
token = client.authenticate()
articles = client.get_article_list()
print(token.token)
print(articles.items)
```
## Notes
Booklooker wraps nearly all responses into a generic envelope with `status` and `returnValue`. This package normalizes those responses into typed Pydantic models so downstream middleware can work with stable structures.