
from django.http import HttpResponseForbidden
from functools import wraps
def require_token(view_func):
    @wraps(view_func)
    def _wrapped_view(request, *args, **kwargs):
        token = request.META.get('HTTP_AUTHORIZATION')
        static_token = 'A3uLHUthhCTba5q62eVG4XSHghB5nmPqk!XZyHsHP'  # Replace with your static token.

        if token == f'Token {static_token}':
            return view_func(request, *args, **kwargs)
        else:
            return HttpResponseForbidden()

    return _wrapped_view
