Skip to content

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.py
index ff9497986..ccfa0d0f1 100644
--- a/api/catalog/api/utils/oauth2_helper.py
+++ b/api/catalog/api/utils/oauth2_helper.py
@@ -3,7 +3,7 @@ import logging
from oauth2_provider.models import AccessToken
-from catalog.api.models import ThrottledApplication
+from catalog.api import models
log = logging.getLogger(__name__)
@@ -25,11 +25,11 @@ def get_token_info(token: str):
return None, None, None
if 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_model
verified = application.verified
- except ThrottledApplication.DoesNotExist:
+ except models.ThrottledApplication.DoesNotExist:
log.warning("Failed to find application associated with access token.")
client_id = None
rate_limit_model = None