HTTP POST File without cURL

John D Giotta jdgiotta at
Wed Sep 9 19:57:22 CEST 2009

I'm working with an API that allows me to POST a zip file via HTTP and
the documentation uses a cURL example. cURL works, but when I try to
POST the file via python it fails.
I don't want to use cURL (since I'm trying to be transparent and
dependency-less), but I can't find anything online that works.

When I use multipart/form-data methods (found here, the recipient cannot
decipher the attached file.

This is about the most difficult thing I've had to do with python and
yet it is supposed to be the very basics of HTTP.

Example cURL command:
curl -v -u username:passwd --data-binary @/home/jdgiotta/ -H
"Content-Type: application/zip" https://host/selector

Is there a valid way to do this?

More information about the Python-list mailing list