Python equivalent of LWP and HTTP in Perl

Dekaritae maur at mdi.ca
Thu Oct 28 15:22:25 EDT 2004


I have a script that I've written in Perl that retrieves files generated 
from a template. It works decently enough, but I'd like to rewrite it in 
Python (Perl was just a detour; it was originally Sed).

Was wondering what the closest thing to what I'm using now in Perl 
(LWP::UserAgent and HTTP::Request:Common) is in Python. The main bit of 
my code is fairly simple.

   my($ua) = LWP::UserAgent->new;
   my $req = GET "$uri";
   $req->header(Referer => "$referer");
   $ua->proxy('http', 'http://localhost:8080/'); # Proxomitron
   $response = $ua->request($req);
   $respcode = $response->code;




More information about the Python-list mailing list