Search code examples
pythonurllib2pycurl

Python: urllib2 or Pycurl?


I have extensive experience with PHP cURL but for the last few months I've been coding primarily in Java, utilizing the HttpClient library.

My new project requires me to use Python, once again putting me at the crossroads of seemingly comparable libraries: pycurl and urllib2.

Putting aside my previous experience with PHP cURL, what is the recommended library in Python? Is there a reason to use one but not the other? Which is the more popular option?


Solution

  • CURL has a lot more features as stated in its web page, so if you need, say fast concurrent connections, safe threading, etc then its for you. However, its not included in the distribution. If you foresee that your task is very simple, then use urllib2 and those HTTP modules that come with the distribution.