cloudinary / pycloudinary

Python package for cloudinary
https://cloudinary.com/documentation/django_integration
Other
251 stars 132 forks source link

Error when adding the metadata field to upload method #358

Closed gaiar closed 12 months ago

gaiar commented 12 months ago

Bug report for Cloudinary Python SDK

Version freshly installed from pip

Describe the bug in a sentence or two.

metadata = {
    "brand_name" : brand_name,
    "brandID" : brandID
}

#{'brand_name': 'papillio', 'brandID': 'PA6'}

result = cloudinary.uploader.upload(
                    folder = "brand-logos",
                    file = path_to_logo,
                    public_id = "{}_{}".format(brandID, 1),
                    tags = brandID,
                    metadata = metadata
                )

This call returns a cryptic error

Error: Invalid value  for parameter kind

If I remove the metadata field, everything works fine

This structure is on Cloudinary side

image

Issue Type (Can be multiple)

Error screenshots or Stack Trace (if applicable)

image

Operating System

Environment and Frameworks (fill in the version numbers)

Vdeub-cloudinary commented 12 months ago

@gaiar this is because you are using the name of the Structured Metadata instead of the external_id. The following code works OK based on your settings:

metadata = {
    "brand_name" : 'papillio',
    "brandid" : 'PA6' --> This is the change
}

#{'brand_name': 'papillio', 'brandID': 'PA6'}

result = cloudinary.uploader.upload("url_of_file",public_id = "test_cloudinary",metadata = metadata)