Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Defer ThrottledApplication reference (#682)
Madison Swain-Bowdenb74c751f1c52
diff --git a/api/catalog/api/utils/oauth2_helper.py b/api/catalog/api/utils/oauth2_helper.pyindex ff9497986..ccfa0d0f1 100644--- a/api/catalog/api/utils/oauth2_helper.py+++ b/api/catalog/api/utils/oauth2_helper.py@@ -3,7 +3,7 @@ import loggingfrom oauth2_provider.models import AccessToken-from catalog.api.models import ThrottledApplication+from catalog.api import modelslog = logging.getLogger(__name__)@@ -25,11 +25,11 @@ def get_token_info(token: str):return None, None, Noneif token.expires >= dt.datetime.now(token.expires.tzinfo):try:- application = ThrottledApplication.objects.get(accesstoken=token)+ application = models.ThrottledApplication.objects.get(accesstoken=token)client_id = str(application.client_id)rate_limit_model = application.rate_limit_modelverified = application.verified- except ThrottledApplication.DoesNotExist:+ except models.ThrottledApplication.DoesNotExist:log.warning("Failed to find application associated with access token.")client_id = Nonerate_limit_model = None