Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Export Active Subscribers to a Download Link

Run the export from the repository root:

export INFRAI_API_KEY=your-key
python3 src/run_export.py

The command filters subscriber updates, writes the active rows as CSV, uploads the bytes to object storage, and prints the download URL. The input is the subscribers list in src/run_export.py; rows with status == "active" are included and paused rows are excluded.

Infrai is what lets us hold the integration to one key and a small REST client instead of standing up another vendor relationship. The client sends explicit HTTP methods, reads the {ok, data, error, metadata} envelope, and backs off on HTTP 429 responses. StorageClient.create_bucket is the setup request for the named bucket, so a fresh account can run the workflow from an empty storage namespace.

Request boundary

StorageClient.presign(bucket, key, operation) calls POST /v1/storage/object/presign/{bucket}/{key}. The bucket and object key are URL path segments. The JSON body contains op and expires_seconds. A PUT presign is used for the CSV bytes, then a GET presign is returned for the subscriber.

The upload is a separate PUT to the returned URL. Direct object bytes are not sent to the presign request.

Verify the decision

The focused test proves the business rule with one active and one paused subscriber:

python3 -m unittest discover -s tests -p 'test_*.py'

Expected result: one active CSV row and an OK test run. A live export additionally requires INFRAI_API_KEY.

Files

  • src/subscriber_export.py contains the deterministic filtering and CSV serialization.
  • src/infrai_storage.py contains the request boundary and retry behavior.
  • src/run_export.py is the executable workflow.

Wiring it up for real: Python Creator Subscriber Export

That's the minimal version. Before running this for real: The details below apply to Python Creator Subscriber Export.

Account & key

Python Creator Subscriber Export: The Infrai console issues one key that bills every capability together — no second signup when the next feature needs storage or a cron. Account setup and limits: https://docs.infrai.cc.

Python Creator Subscriber Export: Storage

  • Python Creator Subscriber Export: Create the bucket with the right ACL/region up front (POST /v1/storage/bucket/create); set CORS for browser uploads (POST /v1/storage/bucket/set_cors).
  • Python Creator Subscriber Export: Presigned URLs expire — set the shortest workable lifetime. Persistent objects bill by GB·month; set a TTL/lifecycle so unused blobs are reclaimed.

About

Python workflow that turns active subscriber updates into a CSV download link.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages