def read_parameters(request, view_kwargs=None, capture_errors=False):  # noqa: C901
    """
    :param request: HttpRequest with attached api_info
    :type request: HttpRequest
    :type view_kwargs: dict[str, object]
    :type capture_errors: bool
    :rtype: dict[str, object]
    """
    if view_kwargs is None:
        view_kwargs = {}
    params = {}
    errors = {}
    for param in request.api_info.operation.parameters:
        try:
            value = param.get_value(request, view_kwargs)
            if value is NO_VALUE:
                if param.has_default:
                    params[param.name] = param.default
                elif param.required:  # Required but missing
                    errors[param.name] = MissingParameter('parameter %s is required but missing' % param.name)
                continue  # No value, or a default was added, or an error was added.
            params[param.name] = param.cast(request.api_info.api, value)
        except (NotImplementedError, ImproperlyConfigured):
            raise
        except Exception as e:
            if not capture_errors:
                raise
            errors[param.name] = e
    if errors:
        raise ErroneousParameters(errors, params)
    return params
:param request: HttpRequest with attached api_info
    :type request: HttpRequest
    :type view_kwargs: dict[str, object]
    :type capture_errors: bool
    :rtype: dict[str, object]