httplib incredibly slow :-(

Aahz aahz at
Wed Aug 19 20:20:22 CEST 2009

In article <mailman.133.1250270175.2903.python-list at>,
Chris Withers  <chris at> wrote:
>Aahz wrote:
>> What do you need to know for a decent example?
>Simple download of a file from a url with some auth headers added would 
>do me.

Well, I've hacked up some sample code from my company's codebase:

# !!! UNTESTED !!!
c = pycurl.Curl()
c.setopt(pycurl.URL, url)
c.setopt(pycurl.USERPWD, "%s:%s" % (user, pwd))
c.setopt(pycurl.FOLLOWLOCATION, 1)
c.setopt(pycurl.MAXREDIRS, 5)
c.setopt(pycurl.CONNECTTIMEOUT, 30)
f = StringIO()
c.setopt(pycurl.WRITEDATA, f)
Aahz (aahz at           <*>

"Given that C++ has pointers and typecasts, it's really hard to have a
serious conversation about type safety with a C++ programmer and keep a
straight face.  It's kind of like having a guy who juggles chainsaws
wearing body armor arguing with a guy who juggles rubber chickens wearing
a T-shirt about who's in more danger."  --Roy Smith

More information about the Python-list mailing list