Looking for the right library for a simple HTTP client
dstanek at dstanek.com
Fri Jul 10 03:34:05 EDT 2009
On Fri, Jul 10, 2009 at 1:29 AM,
scriptlearner at gmail.com<scriptlearner at gmail.com> wrote:
> I am trying to implement a simple client that can do the following:
> 1)to send the following kinds of HTTP requests and validate responses
> 1.1 GET
> 1.2 POST with application/x-www-form-urlencoded encoding
> 1.3 POST with multipart/form-data encoding
> 2)to set any number of (even duplicate) headers. For example, I may
> intentionally add the following Cookie: headers to a request:
> Cookie: id_1=v1;Domain=sample.com;Path=/
> Cookie: id_1=v1;Domain=sample.com;Path=/ <--same as the one above
> Cookie: id_2=v1;Domain=sample.com;Path=/
> 3)to set proxy cfg so requests can go through a proxy server to reach
> the target server.
> 4)to send multiple requests simultaneously.
> I have Python 2.4.1 on Solaris 9 and 10, and I don't have any plan to
> upgrade to latest version of Python.
> I looked around and I found httplib and urllib. Are they sufficient
> for my tasks 1 to 3 above? Any good sample codes will be great.
I like urllib2. The examples are pretty good.
More information about the Python-list