'Send an HTTP request, and catch any exception that might occur due to connection problems.
Safe mode has been removed from requests 1.x.'

def _send_request_safe_mode(self, method, url, **kwargs):

    try:
        return requests.Session.request(self, method, url, **kwargs)
    except (MissingSchema, InvalidSchema, InvalidURL):
        raise
    except RequestException as e:
        r = LocustResponse()
        r.error = e
        r.status_code = 0
        r.request = Request(method, url).prepare()
        return r
