Fix exception caused after upgrading requests