Skip to main content


I am trying to create a ticket using API. I am using python 3.5 and requests library to make the request. I have some custom fields and also want to send some attachments.



here are the code details:



ticket_data = {'subject': 'sub', 'status': 3, 'priority': 2, 'attachments': [('attachments', ('requirements.txt', <_io.BufferedReader name='requirements.txt'>, 'text/plain'))], 'email': 'atul11@gmail.com', 'custom_fields': {'info': 'reason: New Hire\nemployee: emp\nuser: User One\npatch: value1\nteam: value1\ndescription: None\nattachment: None\nrequest_effected_date: None', 'category_name': 'Territory Assignment Change', 'sub_category_name': 'I need to re-assign all accounts in a patch to another AE on my team', 'tenant_id': 'wild-butterfly-354', 'category_id': 'asy8268aissugsudgutsuaytdu2', 'sub_category_id': 'sjkhdksdaakdh89274987'}, 'description': 'des'}






headers = {'Content-type': 'multipart/form-data'}
response = requests.post(url, auth=__AUTH, headers = headers, files=ticket_data)


Error: Too many values to unpack.






What will be the multi-part format for the data I am sending.