Port missing bits from httplib2 to requests

This allows to drop the dependency on httplib2 altogether.

Change-Id: I18571e29d9f0d6527a93ed18becee9148e64e574
Merge "Port missing bits from httplib2 to requests"