1

Possible Duplicate:
Python urllib vs httplib?

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

Community
  • 1
  • 1

2 Answers2

3

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).

Dave
  • 11,499
  • 5
  • 34
  • 46
1

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.

dmedvinsky
  • 8,046
  • 3
  • 31
  • 25