- 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.
14 lines
406 B
Python
14 lines
406 B
Python
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
from booklooker_client import BooklookerConfig, SyncBooklookerClient
|
|
|
|
|
|
api_key = os.environ.get("BOOKLOOKER_API_KEY", "REPLACE_ME")
|
|
config = BooklookerConfig(api_key=api_key)
|
|
|
|
with SyncBooklookerClient(config) as client:
|
|
token = client.authenticate()
|
|
print("Token acquired:", token.token)
|
|
print("Available endpoints:", client.available_endpoints)
|