Make code compatible with the latest version of requests