Metadata-Version: 2.4
Name: straightahead
Version: 0.1.0
Summary: Python client for the StraightAhead production tracker API
Author-email: Alexander Baert <contact@fractilesystems.com>
License: MIT
Project-URL: Homepage, https://straightahead.io
Project-URL: Repository, https://github.com/AlexanderBaert79/CustomStories
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.20

# StraightAhead Python SDK

Python client for the [StraightAhead](https://straightahead.io) production tracker API. Submit renders, animation passes, and other deliverables directly from your pipeline scripts, render farm, or CI system. The file lands in the correct shot and department, the task moves to In Review, and a supervisor can approve or retake it immediately.

## Installation

```bash
pip install straightahead
```

## Quick start

```python
from straightahead import StraightAhead

client = StraightAhead(api_key="sk_your_key", base_url="https://your-studio.example.com")
result = client.submit(shot_code="EP01_SQ0010_SH0040", department="Animation", file="/renders/sh0040_v003.mp4")
print(result)  # Version 42 submitted: EP01_SQ0010_SH0040 / Animation
```

## Validate before submitting

Use `validate()` to confirm the shot and department exist before sending a file.

```python
info = client.validate(shot_code="EP01_SQ0010_SH0040", department="Animation")
if info.has_task:
    result = client.submit(shot_code=info.shot_code, department="Animation", file=render_path)
```

## Error handling

All errors inherit from `StraightAheadError` with a `.message` and `.status_code`.

```python
from straightahead import StraightAhead, StraightAheadError, StraightAheadNotFoundError

client = StraightAhead(api_key="sk_your_key", base_url="https://your-studio.example.com")
try:
    client.submit(shot_code="EP01_SQ0010_SH9999", department="Animation", file="render.mp4")
except StraightAheadNotFoundError:
    print("Shot or department not found")
except StraightAheadError as e:
    print(f"Submission failed: {e.message} (HTTP {e.status_code})")
```

| Exception | HTTP | When |
|-----------|------|------|
| `StraightAheadAuthError` | 401 | API key missing, invalid, or revoked |
| `StraightAheadNotFoundError` | 404 | Shot code or department not found |
| `StraightAheadValidationError` | 422 | No task for shot+department, or no file provided |
| `StraightAheadFileTooLargeError` | 413 | File exceeds 50 MB |
| `StraightAheadConnectionError` | - | Network timeout, refused, DNS failure |

## Environment variables

The example script at `examples/submit_render.py` reads credentials from the environment:

```bash
export SA_API_KEY=sk_your_key_here
export SA_BASE_URL=https://your-studio.example.com
```

## License

MIT
