uploadFile method with python

uploadFile method with python

Hello,

I am struggling to properly upload a text to a lead. I am using the requests library to post the request. I think there is something wrong with my file stream object or I may be missing some header info.

  1. file_stream = io.open('zcrm_%i_example.txt' % lead_id, 'r') params = base_params.copy() params.update({'id': lead_id, 'content': file_stream}) url = json_base_url + 'Leads/uploadFile' resp = requests.post(url, params=params)
Here is the response I am getting, it seems that the 'content' keyword is not in its proper format.

'{"response":{"error":{"message":"Unable to process your request. 
Please verify if the name and value is appropriate for the \\"content\\" parameter.",
"code":"4600"},"uri":"/crm/private/json/Leads/uploadFile"}}\r\n'

Any ideas would be greatly appreciated.

Thanks