fix(api): upgrade django code (pre-commit)

This commit is contained in:
jo 2023-04-24 16:49:12 +02:00 committed by Kyle Robbertze
parent 14357102e5
commit a8e2ce7732
2 changed files with 11 additions and 9 deletions

View file

@ -2,6 +2,7 @@ from secrets import compare_digest
from django.conf import settings
from rest_framework.permissions import BasePermission
from rest_framework.request import Request
from .core.models import Role
@ -48,11 +49,8 @@ def get_permission_for_view(request, view):
return None
def check_authorization_header(request):
auth_header = request.META.get("Authorization")
if not auth_header:
auth_header = request.META.get("HTTP_AUTHORIZATION", "")
def check_authorization_header(request: Request):
auth_header = request.headers.get("authorization", "")
if auth_header.startswith("Api-Key"):
token = auth_header.split()[1]
return compare_digest(token, settings.CONFIG.general.api_key)