Skip to content

Commit

Permalink
async support in authenticator classes
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalik committed Jul 11, 2023
1 parent 0fa606a commit d53623f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ninja/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import django
import pydantic
from asgiref.sync import async_to_sync
from django.http import HttpRequest, HttpResponse, HttpResponseNotAllowed
from django.http.response import HttpResponseBase

Expand Down Expand Up @@ -148,6 +147,8 @@ def _run_checks(self, request: HttpRequest) -> Optional[HttpResponse]:
return None

def _run_authentication(self, request: HttpRequest) -> Optional[HttpResponse]:
from asgiref.sync import async_to_sync

for callback in self.auth_callbacks:
try:
if is_async_callable(callback) or getattr(callback, "is_async", False):
Expand Down

0 comments on commit d53623f

Please sign in to comment.