Metadata-Version: 2.5
Name: imazeo
Version: 1.1.2
Summary: Official Imazeo Python SDK for image transforms, PDF tools, document conversions, website capture, static and dynamic QR codes, barcodes, and saved outputs
Project-URL: Homepage, https://pypi.org/project/imazeo/
Project-URL: Documentation, https://github.com/Imazeohq/imazeo-python#readme
Project-URL: Repository, https://github.com/Imazeohq/imazeo-python
Project-URL: Issues, https://github.com/Imazeohq/imazeo-python/issues
Author: Imazeo
License-Expression: MIT
License-File: LICENSE
Keywords: barcode,conversions,dynamic-qr,images,imazeo,outputs,pdf,qr,sdk,transforms,website-capture
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == 'dev'
Description-Content-Type: text/markdown

# imazeo

Official server-side Python SDK for Imazeo API v1. Transform images, work
with PDFs, render Office documents and public websites, generate QR codes and
barcodes, and manage saved outputs within an Imazeo project.

**Requires Python 3.10+.** [PyPI](https://pypi.org/project/imazeo/) · [API documentation](https://imazeo.com/docs/)

## Install

```bash
pip install imazeo
```

Create a project API key in the [Imazeo customer portal](https://app.imazeo.com/)
and set `IMAZEO_API_KEY` in your server environment. The SDK connects to
`https://api.imazeo.com` and discovers the project for the key by default.

## Quick start

```python
import os
from pathlib import Path

from imazeo import Imazeo

with Imazeo(api_key=os.environ["IMAZEO_API_KEY"]) as client:
    qr = client.qr.generate({
        "content": "https://imazeo.com",
        "format": "png",
        "size": 256,
    })
    Path("qr.png").write_bytes(qr.data)
```

## API keys

Keep the project key in server-side configuration. The SDK sends it in
`X-API-Key` and refuses redirects by default to keep it on the configured origin.

## Resources

Available tools and limits depend on your project plan.

| Resource               | Methods                                                                                               |
| ---------------------- | ----------------------------------------------------------------------------------------------------- |
| `client.context`       | `get()` → project/key IDs                                                                             |
| `client.images`        | `upload`, `list` (`page`/`limit`/`q`), `get`, `delete`, `download`                                    |
| `client.transforms`    | `create`, `list`, `get`, `download` (`if_none_match` → `not_modified`), `delete`                      |
| `client.qr`            | `generate`                                                                                            |
| `client.barcodes`      | `generate`                                                                                            |
| `client.pdf`           | `info`, `render`, `merge`, `extract`                                                                  |
| `client.credits`       | Quote processing credits for an operation and measurable units                                        |
| `client.operations`    | Get status, look up by kind/key, and recover a temporary result                                       |
| `client.conversions`   | DOCX, XLSX, PPTX and website jobs: capabilities, submit, list, lookup, get, cancel, download and save |
| `client.dynamic_codes` | Capabilities, create, list, get, edit, scan analytics and CSV export                                  |
| `client.artifacts`     | Save preview bytes, list, get, download and delete private artifacts                                  |
| `client.outputs`       | List project outputs and retrieve counts by type                                                      |

### Upload + transform

```python
image = client.images.upload(
    photo_bytes,
    filename="photo.jpg",
    content_type="image/jpeg",
)

out = client.transforms.create({
    "imageId": image["_id"],
    "mode": "EPHEMERAL",
    "transform": {"width": 1200, "format": "webp", "quality": 85},
})
# out.data → bytes
```

### Remote URL transform

```python
out = client.transforms.create({
    "url": "https://imazeo.com/examples/assets/field-notebook.png",
    "transform": {"width": 640, "format": "jpeg"},
})
```

### PDF

```python
info = client.pdf.info(pdf_bytes)
page = client.pdf.render(pdf_bytes, {"pages": "1", "format": "png"})
merged = client.pdf.merge([pdf_a, pdf_b])
extracted = client.pdf.extract(pdf_bytes, {"pages": "1,2"})
```

## Errors

```python
from imazeo import ImazeoError, RateLimitError

try:
    client.images.get(image_id)
except RateLimitError as error:
    print(error.code, error.request_id)
except ImazeoError as error:
    print(error.status, error.code, error.message)
```

## Configuration

| Option        | Default                  | Notes                                  |
| ------------- | ------------------------ | -------------------------------------- |
| `api_key`     | required                 | Secret key                             |
| `project_id`  | from context             | Path project                           |
| `base_url`    | `https://api.imazeo.com` | Origin only; `/v1` stripped if present |
| `api_version` | `v1`                     | Allowlisted                            |
| `timeout_ms`  | `60000`                  | PDF uses 120s; QR/barcode 30s          |
| `app_name`    | —                        | Appended to User-Agent                 |
| `transport`   | —                        | Optional `httpx.BaseTransport` (tests) |

## API version

- **API** path version: `v1` (configured via `api_version`)

`Imazeo.api_compatibility()` reports supported API versions.

## Integration guide

See the [integration guide](https://github.com/Imazeohq/imazeo-python/blob/main/GUIDE.md) for image processing, multi-page PDF
responses, conversion jobs, dynamic QR, pagination and output retention.

## Development

```bash
pip install -e ".[dev]"
pytest
```

## Barcode and PDF notes

Barcode generation requires `type` and string `content`. Optional `format` is
`png` or `svg` (default `png`); `includeText` defaults to `true`.
PDF merge uploads files in order as repeated multipart `file` parts.
Omit optional fields to use API defaults. Integer fields such as barcode scale
and image hue must be integers.

```python
client.barcodes.generate({'type': 'code128', 'content': 'IMAZEO-2026', 'format': 'svg', 'includeText': False})
```

## License

MIT
