Skip to content

Instantly share code, notes, and snippets.

@orian
Created February 28, 2025 22:20
Show Gist options
  • Save orian/b5efd39c793b97c4ca046ee0c662d762 to your computer and use it in GitHub Desktop.
Save orian/b5efd39c793b97c4ca046ee0c662d762 to your computer and use it in GitHub Desktop.
class TeamConcurrentThrottle(BaseThrottle):
def allow_request(self, request, view):
personal_api_key = PersonalAPIKeyAuthentication.find_key_with_source(request)
if request.user.is_authenticated and personal_api_key is None:
return True
team_id = PersonalApiKeyRateThrottle.safely_get_team_id_from_view(view)
if team_id is None:
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment