18 lines
414 B
Python
18 lines
414 B
Python
from django.conf import settings
|
|
from ninja import NinjaAPI
|
|
from ninja.security import APIKeyHeader
|
|
|
|
|
|
class SecretKeyAuth(APIKeyHeader):
|
|
param_name = "X-Secret-Key"
|
|
|
|
def authenticate(self, request, key):
|
|
return key if key == settings.API_SECRET else None
|
|
|
|
|
|
api = NinjaAPI(auth=SecretKeyAuth())
|
|
|
|
from scores.api import router as scores_router # noqa: E402
|
|
|
|
api.add_router("/scores", scores_router)
|