(allowed)
return outer
Validate if only allowed params are present in request.GET.
Validate if only allowed params are present in request.GET.
Validate if only allowed params are present in request . GET .
def check_params(allowed):
    """
    Validate if only allowed params are present in request.GET.
    """
    def outer(func):
        @wraps(func)
        def inner(request, **kwargs):
            incoming = set(request.GET.keys())
            # Expected parameter names.
            diff = incoming - allowed
            if diff:
                logger.warning(f"invalid get request parameters {diff}")
                raise Http404("Parameter does not exist.")

            return func(request, **kwargs)

        return inner

    return outer
def check_params ( allowed ) : def outer ( func ) : @ wraps ( func ) def inner ( request , * * kwargs ) : incoming = set ( request . GET . keys ( ) ) # Expected parameter names. diff = incoming - allowed if diff : logger . warning ( f"invalid get request parameters {diff}" ) raise Http404 ( "Parameter does not exist." ) return func ( request , * * kwargs ) return inner return outer