yungle SDK. It uploads resumably, retries safely, and gives you the link.
Prerequisites
- Python 3.9 or newer.
- An API key with
transfers:write, plustransfers:readto check download receipts. - The SDK:
Send in one call
send() creates a transfer, uploads each file, and sends it. It returns the sent transfer with a notified list of who was emailed.
send_report.py
to and nobody is emailed: you get a link to pass on yourself. send() also takes password and expires_in_days; the lifetime is clamped to your plan’s maximum.
send() uploads each file under its own name, without folders. To keep a folder structure, register the files yourself with a path, as in the next section.Send step by step
Use the separate calls when you want folders, progress output, or to do something between upload and send.1
Create a draft
Register every file with its exact size in bytes. A draft is not live and nobody is emailed yet.
draft holds the transfer, the upload endpoint, and one target per file, in the order you registered them:2
Upload each file
upload_file streams one file to its target over tus. It resumes from the last part the server committed after a dropped connection.upload_file returns the upload URL. Store it and pass it back as upload_url= to resume the same upload from another process.3
Send it
Finalize the transfer. This is safe to retry: nobody is emailed twice.
4
Check the downloads
Read the receipts later with the transfer id.To be told instead of polling, subscribe to
transfer.downloaded with a webhook.Handle errors
A failed request raisesYungleError. Branch on code, never on the message.
429) and server errors (5xx) up to three times with backoff, honoring Retry-After. Every POST carries an Idempotency-Key, so a retried create never makes a second transfer. Change the retry count with Yungle(max_retries=…). Every code is listed on Errors.
Next steps
SDKs
Every method in the Python and JavaScript SDKs.
Upload large files
How the resumable upload protocol works underneath.
Client collections
Deliver into a lasting collection instead of an expiring transfer.
Send from CI
Send from GitHub Actions or cron with the CLI.
