python-requests 1.x compatibility

Thanks to Mikael for bug report. Fixes #2367.