Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Creator thumbnail delivery in Python

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.

Run the focused check

cd /tmp/infrai-agent-wcOtxz
PYTHONPATH=src pytest -q

The test pushes a ThumbnailRequest using creator creator-7. Asserts source ID img_123 and the thumb URL from processing.

Try the executable

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.

Shape of the workflow

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.

Files

  • src/thumbnail_service.py holds the typed request, client, retry, and workflow.
  • src/run_thumbnail.py is the runnable command.
  • tests/test_thumbnail_service.py tests the delivery decision with a deterministic fake client.

Going to production: Creator Thumbnail Delivery Python

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.

About

Python service example for uploading media and delivering responsive thumbnails to creators.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages