httplib incredibly slow :-(
Aahz
aahz at pythoncraft.com
Wed Aug 19 14:20:22 EDT 2009
In article <mailman.133.1250270175.2903.python-list at python.org>,
Chris Withers <chris at simplistix.co.uk> 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)
c.perform()
c.close()
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"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