Releasing our official Python SDK
And the SDKs keep rolling in! 😄 Yet again, we are proudly announcing another official SDK release. Guess who is joining our list this time around? (HINT: 🐍)
That's right, it's our brand new, fully featured Python SDK!
Like the Java SDK, this one also comes with the following features:
- Create an Assembly (of course). This comes with full support for tus resumable uploads, which is great for when you are uploading large files on an unreliable network.
- Get an Assembly
- Cancel the execution of an Assembly
- List Assemblies
- Create a Template
- Update a Template
- Delete a Template
- List Templates
- Get a Template
- Get the monthly bill for your account
Here are a few quick steps to help you get started:
1. Install the SDK with pip
pip install pytransloadit
Now head to your code editor and let's get started!
2. Import the transloadit.client
module, and instantiate the Transloadit
class. This will
require you to enter your API credentials:
from transloadit import client
tl = client.Transloadit('YOUR_TRANSLOADIT_KEY', 'YOUR_TRANSLOADIT_SECRET')
3. Create a new Assembly instance and add the file that you want to upload, along with your preferred Assembly Steps and Instructions, in order to process it. After doing so, your code should look like this:
from transloadit import client
tl = client.Transloadit('YOUR_TRANSLOADIT_KEY', 'YOUR_TRANSLOADIT_SECRET')
assembly = tl.new_assembly()
assembly.add_file(open('PATH/TO/FILE.jpg', 'rb'))
assembly.add_step('resize', '/image/resize', {'width': 70, 'height': 70})
4. Submit the Assembly to Transloadit by calling the create
method. This method
enables tus' resumable uploads by default. You can also choose to add the wait
(boolean) parameter in order to wait for the encoding to finish before getting a response.
from transloadit import client
tl = client.Transloadit('TRANSLOADIT_KEY', 'TRANSLOADIT_SECRET')
assembly = tl.new_assembly()
assembly.add_file(open('PATH/TO/FILE.jpg', 'rb'))
assembly.add_step('resize', '/image/resize', {'width': 70, 'height': 70})
assembly_response = assembly.create(wait=True)
print assembly_response.data.get('assembly_id')
And there you have it: in fewer than ten lines, you have saved the world! 🌍
For more detailed documentation and examples, please take a look at:
- Examples: https://github.com/transloadit/python-sdk/tree/master/examples
- Source code: https://github.com/transloadit/python-sdk
- Documentation: https://transloadit.readthedocs.io/en/latest/
We hope you are as excited about these releases as we are!