Search code examples
pythonhttplibpersistent-connection

Does python httplib allow persistent connection?


As I read the sample code, I first need to open and connection

conn = httplib.HTTPSConnection(server)

and then I can send multiple requests without making a new connection:

 conn.request(...)

So does it mean that I have a persistent connection ? Or httplib will make a new connection every request ? How to ensure a persistent connection with httplib ?


Solution

  • No. Your best bet is httplib2.