Looking for the right library for a simple HTTP client

S

scriptlearner

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.
Thanks.
 
D

David Stanek

On Fri, Jul 10, 2009 at 1:29 AM,
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.
Thanks.

I like urllib2. The examples[1] are pretty good.

[1] http://www.python.org/doc/2.4.1/lib/urllib2-examples.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,061
Latest member
KetonaraKeto

Latest Threads

Top