Asynchronously upload images to Cloudinary using the Python API


Asynchronously upload images to Cloudinary using the Python API
I am trying to asynchronously upload images to Cloudinary using their Python API.
Their documentation states the following is required to upload an image.
result = cloudinary.uploader.upload(file, **options)
Since, I would like to upload asynchronously, it appears I need to set the "async" option to True (also in the documentation).
async (Boolean): Tells Cloudinary whether to perform the upload
request in the background (asynchronously). Default: false.
Since options has **, as explained in this SO post, I assume that the function accepts keyword arguments like so.
response = await cloudinary.uploader.upload(img, async=True)
However, when I run my script, I get the following error:
File "async_upload.py", line 16
response = await cloudinary.uploader.upload(img, async=True)
^ SyntaxError: invalid syntax
How do I upload multiple images asynchronously in Cloudinary?
async
@KlausD. ahhhhhh that makes a lot of sense! Hmmm...I wonder what I should use instead :L
– user5814
yesterday
1 Answer
1
There isn't a specific Cloudinary method. You can use asyncio to upload asynchronously. https://medium.freecodecamp.org/a-guide-to-asynchronous-programming-in-python-with-asyncio-232e2afa44f6
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
async
is a reserved Python keyword now. The API lib seems to be older than that.– Klaus D.
yesterday