HTTP Persistent connection

John Gordon gordon at panix.com
Mon Oct 3 16:51:43 EDT 2011


In <27527508.4070.1317674357487.JavaMail.geo-discussion-forums at yqnk41> pedr0 <pulsarpietro at gmail.com> writes:

> I forget to insert second request.
> host = "www.higuys.net"
> #first request
> http_connection =  httplib.HTTPConnection(host)
> http_connection.request(method,url_first,headers=headers)
> response = http_connection.getresponse()
> #second request
> http_connection =  httplib.HTTPConnection(host)
> http_connection.request(method,url_second,headers=headers)
> response = http_connection.getresponse()

I haven't used httplib much so maybe this is a dumb question, but if
you want to reuse the same connection, why are you declaring two separate
HTTPConnection objects?  Wouldn't you want to reuse the same object?

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon at panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"




More information about the Python-list mailing list