narrowcast/facebook-ads-api — pull request #10 by agriffis (2014-04-24 11:45:09+00:00)
Title: Switch from urllib2 to requests

Using the requests library simplifies the code while adding the benefit of HTTP connection pooling powered by urllib3. Most Python applications already use the requests library, so it should be fine to add the dependency.

This commit also changes the URL handling to use URLObject rather than manually concatenating with slashes and question marks. That way there's no chance of doubled slashes, and query strings are merged properly.

Additional notes:
* Error handling and behavior of `AdsAPIError` is preserved.
* `MultipartFormdataEncoder` is no longer needed, since the library handles that.
* `make_labeled_batch_request` is simplified since the error handling is in `make_batch_request` (this is actually true regardless of the rest of this commit). It will additionally preserve an `OrderedDict` if passed in by the caller.