'Constructs and sends a :py:class:`requests.Request`.
Returns :py:class:`requests.Response` object.
:param method: method for the new :class:`Request` object.
:param url: URL for the new :class:`Request` object.
:param name: (optional) An argument that can be specified to use as label in Locust\'s statistics instead of the URL path.
This can be used to group different URL\'s that are requested into a single entry in Locust\'s statistics.
:param catch_response: (optional) Boolean argument that, if set, can be used to make a request return a context manager
to work as argument to a with statement. This will allow the request to be marked as a fail based on the content of the
response, even if the response code is ok (2xx). The opposite also works, one can use catch_response to catch a request
and then mark it as successful even if the response code was not (i.e 500 or 404).
:param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`.
:param data: (optional) Dictionary or bytes to send in the body of the :class:`Request`.
:param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`.
:param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`.
:param files: (optional) Dictionary of ``\'filename\': file-like-objects`` for multipart encoding upload.
:param auth: (optional) Auth tuple or callable to enable Basic/Digest/Custom HTTP Auth.
:param timeout: (optional) How long to wait for the server to send data before giving up, as a float,
or a (`connect timeout, read timeout <user/advanced.html#timeouts>`_) tuple.
:type timeout: float or tuple
:param allow_redirects: (optional) Set to True by default.
:type allow_redirects: bool
:param proxies: (optional) Dictionary mapping protocol to the URL of the proxy.
:param stream: (optional) whether to immediately download the response content. Defaults to ``False``.
:param verify: (optional) if ``True``, the SSL cert will be verified. A CA_BUNDLE path can also be provided.
:param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, (\'cert\', \'key\') pair.'

def request(self, method, url, name=None, catch_response=False, **kwargs):

    url = self._build_url(url)
    request_meta = {}
    request_meta['method'] = method
    request_meta['start_time'] = time.time()
    response = self._send_request_safe_mode(method, url, **kwargs)
    request_meta['response_time'] = int(((time.time() - request_meta['start_time']) * 1000))
    request_meta['name'] = (name or ((response.history and response.history[0]) or response).request.path_url)
    if kwargs.get('stream', False):
        request_meta['content_size'] = int((response.headers.get('content-length') or 0))
    else:
        request_meta['content_size'] = len((response.content or ''))
    if catch_response:
        response.locust_request_meta = request_meta
        return ResponseContextManager(response)
    else:
        try:
            response.raise_for_status()
        except RequestException as e:
            events.request_failure.fire(request_type=request_meta['method'], name=request_meta['name'], response_time=request_meta['response_time'], exception=e)
        else:
            events.request_success.fire(request_type=request_meta['method'], name=request_meta['name'], response_time=request_meta['response_time'], response_length=request_meta['content_size'])
        return response
