I have written a little app that generates images from Matplotlib in Python and then uploads it via Cloudinary. I get errors such like:
Failed to upload image: Unexpected error - ReadTimeoutError("HTTPSConnectionPool(host='api.cloudinary.com', port=443): Read timed out. (read timeout=<object object at 0x7f30797ee240>)",)
Weirdly enough, when one upload fails, the next works again. I have a feeling that the error occurs after a period where no image was uploaded for a couple of minutes. Any ideas are welcome! The function that does the uploading looks like this:
def upload_image(image, hash):
"""Takes a path to an image an uploads it. Return the Image URL"""
result = cloudinary.uploader.upload(image, public_id = hash)
URL = cloudinary.utils.cloudinary_url(result['public_id'])
logger.debug("Uploaded image: %s", URL)
except cloudinary.api.Error as e:
logger.warn("Failed to upload image: %s", e)
URL = "http://res.cloudinary.com/destats/image/upload/" + hash
Please sign in to leave a comment.