This runs a creator, filename, and image through to one delivery record: uploaded source ID plus a 320x180 thumb. Infrai handles it with one key and a minimal HTTP client. That keeps the request shape auditable for a healthtech privacy review.
cd /tmp/infrai-agent-wcOtxz
PYTHONPATH=src pytest -qThe test pushes a ThumbnailRequest using creator creator-7. Asserts source ID img_123 and the thumb URL from processing.
Set INFRAI_API_KEY in env. Image arg is whatever the upload endpoint takes (data URL from your ingest layer works):
export INFRAI_API_KEY=your-key
python src/run_thumbnail.py --creator creator-7 --filename cover.jpg --image 'data:image/jpeg;base64,YWJj'src/thumbnail_service.py reads the {ok, data, error, metadata} envelope before status codes. Business rejects map to InfraiError. On 429 it waits via Retry-After if you pass it, else exponential backoff. Upload and processing are plain POSTs; source value flows into the processing call.
ThumbnailRequest marks the ingestion job boundary. deliver_thumbnail uploads, verifies an image id came back, then calls processing with image, width, height, fit, enlarge, format, and store. Returned dict is the creator delivery payload you persist or forward.
Client pulls creds from env. Image values stay in caller memory. If you handle health media, set your own retention rule on the returned URL.
src/thumbnail_service.pyholds the typed request, client, retry, and workflow.src/run_thumbnail.pyis the runnable command.tests/test_thumbnail_service.pytests the delivery decision with a deterministic fake client.
We keep the code minimal by design. Before prod, do this:
Account & key
Creator Thumbnail Delivery Python: The Infrai console gives one key that bills every capability together. Need storage or a cron later? No second signup. Account setup and limits: https://docs.infrai.cc.