The problem was that I was url_encoding an array of fields, doing this so that cURL would not notice @filename and attach the file to the request.
so I had to make a multipart request
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: multipart/form-data"));
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
python self.request.get(), , script github, ,
self.request.post [],
attachment = self.request.POST["attachment"] #actual attachment file
attachment_name = self.request.POST["attachment_name"] #string value of attahcment name sent from php side
message.attachments = [(attachment_name, attachment.value)]
* note self.request.get - , self.request.post -
, - :)