XML content in a POST request (httplib)?

Alex Martelli aleax at aleax.it
Fri Jul 5 17:23:26 EDT 2002


Gordian Gossen wrote:

> Hello,
> 
> I would like to transmit the content of a XML-file in the body of a
> POST request.
> 
> -------------------------------------------------------------
> What i did not understand:
> --------------------------
> 
> How to put the a string, which contains the XML content, into the body
> without making a key value pair?
> 
> Does I need a key value /pair to transmit data in the POST request
> body?

urllib currently lets you to post only content type x-www-form-urlencoded.

/F once posted a simple patch to overcome that, 
http://mail.python.org/pipermail/patches/2000-April/000493.html -- you
may try to work things out from there (I don't think it was ever integrated
in the standard library).  Or, use different means than urllib -- httplib 
lets you do that easily (method 'request' of HTTPConnection instances).


Alex




More information about the Python-list mailing list