scelis/pykol — pull request #29 by starwed (2013-10-01 19:56:12+00:00)
Title: Swith urllib2 to requests

This patch switches the http library used by pykol from *urllib2* to [requests](http://docs.python-requests.org/en/latest/). The latter library is generally more capable, has a friendlier API, and importantly, is able to avoid a new HTTP request every time a resource is requested from the server. That seems to have a noticible impact if you do lots and lots of requests in a row.

This passes the unit tests. Changes were pretty minimal; the key changes were to Session.py and GenericRequest.py, and the only other changes necessary were to switch response.getUrl() to response.url. (Perhaps that should be abstracted?)

It does add an additional dependency to pykol, of course. And I have no idea how comprehensive the unit tests are, or if its common for code using pykol to directly mess with the response object, etc. But this was easy enough I thought I'd just open a PR so you could see the changes I made. :)