Convert dictionary to HTTP POST
sybrenUSE at YOURthirdtower.com.imagination
Fri Mar 3 10:22:59 CET 2006
Laszlo Zsolt Nagy enlightened us with:
> How can I convert a dictionary into a HTTP POST string? I have an
> example below, but this is not working correctly for special
> characters. (" ' and others).
> In other words, if I use "Bessy's cat" instead of "Bessy" then the
> http server will parse that to "Bessy's cat"
The HTTP server won't perform HTML-quoting out of thin air.
> Probably the problem is that I should not use urllib.quote but
> something else.
URL-quoting is the right thing to do:
In : import urllib
In : urllib.quote("Bessy's cat")
If you want to give yourself an example of how it's done, run a
network sniffer and post something to a website.
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
More information about the Python-list