Skip to content

Commit

Permalink
Remove ratelimit for internal get apis (#2177)
Browse files Browse the repository at this point in the history
remove ratelimit for internal get apis

Co-authored-by: Khavin Shankar <[email protected]>
Co-authored-by: Vignesh Hari <[email protected]>
  • Loading branch information
3 people authored May 22, 2024
1 parent 5670c81 commit 62c4364
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 33 deletions.
24 changes: 0 additions & 24 deletions care/abdm/api/viewsets/consent.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,30 +140,6 @@ def fetch(self, request, pk):
ConsentRequestSerializer(consent).data, status=status.HTTP_200_OK
)

def list(self, request, *args, **kwargs):
if ratelimit(request, "consent__list", [request.user.username]):
raise CaptchaRequiredException(
detail={
"status": 429,
"detail": f"Request limit reached. Try after {USER_READABLE_RATE_LIMIT_TIME}",
},
code=status.HTTP_429_TOO_MANY_REQUESTS,
)

return super().list(request, *args, **kwargs)

def retrieve(self, request, *args, **kwargs):
if ratelimit(request, "consent__retrieve", [kwargs["pk"]]):
raise CaptchaRequiredException(
detail={
"status": 429,
"detail": f"Request limit reached. Try after {USER_READABLE_RATE_LIMIT_TIME}",
},
code=status.HTTP_429_TOO_MANY_REQUESTS,
)

return super().retrieve(request, *args, **kwargs)


class ConsentCallbackViewSet(GenericViewSet):
permission_classes = (IsAuthenticated,)
Expand Down
9 changes: 0 additions & 9 deletions care/abdm/api/viewsets/health_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@ class HealthInformationViewSet(GenericViewSet):
permission_classes = (IsAuthenticated,)

def retrieve(self, request, pk):
if ratelimit(request, "health_information__retrieve", [pk]):
raise CaptchaRequiredException(
detail={
"status": 429,
"detail": f"Request limit reached. Try after {USER_READABLE_RATE_LIMIT_TIME}",
},
code=status.HTTP_429_TOO_MANY_REQUESTS,
)

files = FileUpload.objects.filter(
Q(internal_name=f"{pk}.json") | Q(associating_id=pk),
file_type=FileUpload.FileType.ABDM_HEALTH_INFORMATION.value,
Expand Down

0 comments on commit 62c4364

Please sign in to comment.