Whenever looking at API libraries for Python, there seems to be about half of them simply using:
response = urllib2.urlopen('https://www.example.com/api', data)
and about half using:
connection = httplib.HTTPSConnection('www.example.com/api')
# ... rest omitted for simplicity
I tend to think the second version is "cooler" (I'm biased towards a more OO approach to most things).
Is there a benefit or reason for using one over the other. Or, am I missing something along the way. I would suspect that urllib2.urlopen
uses HTTPSConnection
in its implementation, so perhaps one is simply less coding on my behalf. Whichever way, I'd love some feedback. Thanks.