This support forum is no longer in use. Please use the Cloudinary Community at https://community.cloudinary.com/ to receive assistance from other members of the community and from Cloudinary's support team. For account-specific questions or if you believe that you've encountered a bug, please contact the Cloudinary team directly via the "submit a request" option on this support site.

Asynchronously upload images to Cloudinary using the Python API

Comments

13 comments

  • Avatar
    Daniel Mendoza

    Hi @Patrick,

    I apologize for the delay.

    Can you clarify if you are trying to do the call asynchronously on your end or through Cloudinary? By adding the async=True parameter, the request is processed in the background. When using the async=True parameter, the notification_url="www.example.com/myendpoint" can be added to let you know when the upload has completed. However, it should not take long to process the request.

    I am looking to your update.

    0
    Comment actions Permalink
  • Avatar
    Patrick

    Hey Daniel. Unfortunately, the problem I'm having is that the Python interpreter won't run my code with async=True flag since "async" is now a reserved word in Python 3.

    0
    Comment actions Permalink
  • Avatar
    Daniel Mendoza

    We need to gather more details to understand what may be the issue. I was able to a python3 project with async=True. Can you try running this/modifying this script to what you have, and send us the stack trace.

    ----

    import cloudinary
    import cloudinary.uploader
    import cloudinary.api

    # Prints current version of Python being used.
    import sys
    print(sys.version + "\n")

    upload = cloudinary.uploader.upload("path/to/file", async=True, notification_url="www.example.com/myendpoint");
    print(upload)

    ----

    If you wish to have a private conversation about this, please open a support ticket at https://support.cloudinary.com/hc/en-us/requests/new and address it to me.

    0
    Comment actions Permalink
  • Avatar
    Patrick

    Hi Daniel, the following was a reply to a post I made about this issue on the Cloudinary Community Facebook page. I believe the issue is specifically related to Python 3.7 (my apologies). Additionally, it appears async parameter doesn't actually work per the open github issue. Are you able to confirm?

    async is a reserved word starting in Python 3.7, but not in earlier versions of Python. Cloudinary should probably update their library to rename the parameter. However. in the meantime, I believe you should be able to pass in the parameter using cloudinary.uploader.upload(image", **{'async': True}).

    (That being said, a GitHub issue indicates the async parameter doesn't actually work anyway at the moment: https://github.com/cloudinary/pycloudinary/issues/84)

    0
    Comment actions Permalink
  • Avatar
    Daniel Mendoza

    Hi @Patrick,

    I really apologize for the delay.

    There is a current issue with the `async` keyword on Python 3.7 conflicting with the async parameter on Cloudinary. I've informed our dev team and they are aware of this issue. They are looking into possible solutions.

    Once I receive any updates from them, I will let you know.

     

    1
    Comment actions Permalink
  • Avatar
    Patrick

    Thanks for the update Daniel!

    0
    Comment actions Permalink
  • Avatar
    Kyle

    5 months have past and this is still an issue. Any updates?

    0
    Comment actions Permalink
  • Avatar
    Daniel Mendoza

    @Patrick @Kyle

    We have a temporary workaround:

    async_option = {"async": True}
    uploader.upload(TEST_IMAGE,  **async_option)

    Let me know if this is helpful.

    0
    Comment actions Permalink
  • Avatar
    Kyle

    I saw that. We will use that workaround for now, thanks. Hoping for a better solution, as this is kind of ugly.

    0
    Comment actions Permalink
  • Avatar
    Deven Vyas

    @Daniel, I have run into the same issue and have used the workaround for now. Is a solution for this being worked on?

    0
    Comment actions Permalink
  • Avatar
    Daniel Mendoza

    @Deven

    We currently do not have an eta for replacing the workaround, but we I receive an update I will be glad to share it.

    0
    Comment actions Permalink
  • Avatar
    Danny Bos

    Is there an update to this?
    Two years later, still an issue and we're at Python 3.9.

    0
    Comment actions Permalink
  • Avatar
    Loic Verger Del Bove

    Hi Danny,

    There isn't an update so far.

    As my colleague Eric mentioned in the ticket you also created, please use the workaround:

    async_option = {"async": True}

    In the meantime, we are checking internally with the team.

    Best,

    Loic

    0
    Comment actions Permalink

Post is closed for comments.