Modified to be able to use with Requests 1.x