Search code examples
pythonhttpurllib2keep-alive

What is the best way to use HTTP Keep-Alive in Python 2.7


There are several options to use Keep-Alive. I'm trying to use urllib2 to use Keep-Alive, but it doesn't officially support it in Python 2.7. I heard pycurl had the funciton. That's why I'm here to ask.

Could you kindly tell me what is the best practice to use Keep-Alive in Python?

EDIT

Some said this question had been already asked, but I suppose many people are confused about what module they should to use for Keep-Alive. This is NOT talking about urllib2.


Solution

  • I would suggest to use requests library. It has Keep-Alive support in addition to many other features.