0

I'm expecting problems with migrating from requests to pyCurl, my code looks like this:

c = pycurl.Curl()
c.setopt(c.POST, 1)
c.setopt(c.URL, self.UploadURL)
c.setopt(c.HTTPPOST, [("files[]", (c.FORM_FILE, local_path))])
c.perform()
c.close()

But it always gives me weird "404 - Not Found" error, self.UploadURL looks like this:

http://s1.example.com/Upload?e=hB3DRDMTrp1qXfLYcGlb7IEDgQFgg7j5_WxnaYzJckfmCXT_ggm4f4T6Byk1WJWpkpiXzp2R8N1bG3J0qixKbJ7Nc1k5hR5dUTGsHjxzLgG0QL8Pl5a95ygehKcAzz5jpirHKWDJQ1c_uJW9UbuXMw&pv=2

As you can see, it has non-standard characters like ?, =, _, & and is quite long :P. Additionaly: i don't even know what my script is sending to server because program Fiddler4 doesn't catch that request o_O

Additionaly, this is working code, but its uses requests (and i want pyCurl):

files = MultipartEncoder[("files[]", (filename, filedata, 'application/octet-stream'))]
UploadFile = requests.post(self.UploadURL, data=files, headers={'Content-Type': files.content_type}, stream=True)
Marek Grzyb
  • 177
  • 13

1 Answers1

0

Trying using base64 encoding for query paramter.

Falguni
  • 11
  • 3