freshworks / fresh-samples

Samples of code created by freshdesk
184 stars 181 forks source link

having non ASCII characters in filenames #58

Open ValentinCoudert opened 5 years ago

ValentinCoudert commented 5 years ago

Hello,

(I'm referring to Python/create_ticket_attachment.py)

I have a pretty similar code to this one (except that I only pass my attachments in files=... and I pass the other info in data=..., all encoded to be multipart/form compliant).

My filenames have non ASCII characters, like 'deux-étoiles.jpg' and I get an error

{"description":"Validation failed","errors":[{"field":"attachments","message":"It should contain elements of type valid file format only","code":"datatype_mismatch"}]}

My call

# This code works without problem when only ascii chars in filenames
r = requests.post(url, files=attached_files, data=multipart_data, auth=auth)