'Restore response object after unpickling'

def restore_response(self, response):

    result = requests.Response()
    for field in self._response_attrs:
        setattr(result, field, getattr(response, field))
    result.history = tuple((self.restore_response(r) for r in response.history))
    return result
