Question

Possible Duplicate:
Python urllib vs httplib?

I am just curious when I would want to use httplib over urllib2 and vice versa.

Was it helpful?

Solution

Basically - httplib is lower level, while urllib is high-level. Use urllib2 whenever you just need to do something basic, like read the contents of a web site. Use httplib when you need to do something more crazy (hopefully rarely).

OTHER TIPS

You may wanna give python-requests a look instead of urllib2 if you want to do some higher level HTTP code. httplib is rarely used directly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top