remove restriction when using open api

This commit is contained in:
zema1 committed 2018-12-16 10:36:43 +08:00
1 parent 745dba8cad
commit 03c68419b0
5 files changed
+9 -5

No files matched your search

+4
View File
@@ -18,6 +18,10 @@ from ..serializers import SubmissionSafeModelSerializer, SubmissionListSerialize
class SubmissionAPI(APIView):
def throttling(self, request):
# 使用 open_api 的请求暂不做限制
auth_method = getattr(request, "auth_method", "")
if auth_method == "api_key":
return
user_bucket = TokenBucket(key=str(request.user.id),
redis_conn=cache, **SysOptions.throttling["user"])
can_consume, wait = user_bucket.consume()