curl-and-python

Setting content type for HTTPPOST?

From: Michael Wood <esiotrot_at_gmail.com>
Date: Mon, 11 Oct 2010 19:02:36 +0200

Hi

I'm using PycURL to upload a file but I'm having trouble figuring out
how to specify the content type of the file. It's currently coming
through as text/plain and the server seems to be converting the DOS
line end characters to UNIX line end characters. When the file is
uploaded, the server calculates the checksum to send back to the
client so that the client knows that the file is not corrupted, so
this EOL conversion breaks the checksum.

At the moment I'm doing this:

        pf = [("report", (pycurl.FORM_FILE, filename)),
              ("checksum", self.checksum)]
        curl.setopt(pycurl.HTTPPOST, pf)

I see there's a FORM_CONTENTTYPE option, but I haven't noticed
documentation on it or exactly how to use it. Perhaps I've been
looking in the wrong place, in which case I'd appreciate a pointer to
the right place :)

Thanks in advance.

-- 
Michael Wood <esiotrot_at_gmail.com>
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2010-10-11