T1-T4: tests de resilience, SDK PyPI ready, worker docker-compose, fix compat tests
This commit is contained in:
+63
-1
@@ -8,6 +8,22 @@ The official Python client for interacting with the Imago backend API.
|
||||
pip install imago-client
|
||||
```
|
||||
|
||||
For development:
|
||||
```bash
|
||||
cd sdk
|
||||
pip install -e ".[dev]"
|
||||
```
|
||||
|
||||
## Publishing to PyPI
|
||||
|
||||
```bash
|
||||
cd sdk
|
||||
pip install build twine
|
||||
python -m build
|
||||
twine check dist/*
|
||||
twine upload dist/*
|
||||
```
|
||||
|
||||
## Basic Usage
|
||||
|
||||
```python
|
||||
@@ -25,7 +41,7 @@ async def main():
|
||||
stream = client.images.stream_pipeline(image.id, "your-api-key")
|
||||
async for event in stream.stream_events():
|
||||
print(f"Event: {event}")
|
||||
|
||||
|
||||
# Get processed data
|
||||
processed = await client.images.get(image.id)
|
||||
if processed.ai:
|
||||
@@ -34,3 +50,49 @@ async def main():
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
### HubClient
|
||||
|
||||
```python
|
||||
client = HubClient(
|
||||
base_url="http://localhost:8000", # Imago API URL
|
||||
api_key="your-api-key", # Imago API key
|
||||
timeout=30.0, # Request timeout (seconds)
|
||||
)
|
||||
```
|
||||
|
||||
### Images Resource
|
||||
|
||||
```python
|
||||
# Upload
|
||||
image = await client.images.upload(data, filename, content_type="image/jpeg")
|
||||
|
||||
# Get
|
||||
detail = await client.images.get(image_id)
|
||||
|
||||
# List
|
||||
images = await client.images.list(page=1, page_size=20, tag="nature")
|
||||
|
||||
# Delete
|
||||
await client.images.delete(image_id)
|
||||
|
||||
# Reprocess
|
||||
await client.images.reprocess(image_id)
|
||||
|
||||
# WebSocket pipeline stream
|
||||
stream = client.images.stream_pipeline(image_id, api_key)
|
||||
async for event in stream.stream_events():
|
||||
print(event)
|
||||
```
|
||||
|
||||
### AI Resource
|
||||
|
||||
```python
|
||||
# Summarize URL
|
||||
result = await client.ai.summarize("https://example.com")
|
||||
|
||||
# Draft task
|
||||
task = await client.ai.draft_task("Organiser les photos de vacances")
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user