Features: 1) Update rate limit logic to dynamically adjust based on settings.DEBUG instead of hardcoded DEBUG;
Fixes: 1) Remove unused import of `DEBUG` from settings; Extra: n/a;
This commit is contained in:
parent
b1c022b974
commit
6a42907060
2 changed files with 2 additions and 3 deletions
|
|
@ -428,7 +428,7 @@ class BuyAsBusinessView(APIView):
|
|||
Handles the "POST" request to process a business purchase.
|
||||
"""
|
||||
|
||||
@method_decorator(ratelimit(key="ip", rate="10/h", block=True))
|
||||
@method_decorator(ratelimit(key="ip", rate="10/h" if not settings.DEBUG else "888/h"))
|
||||
def post(self, request, *_args, **kwargs):
|
||||
serializer = BuyAsBusinessOrderSerializer(data=request.data)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
|
|
|
|||
|
|
@ -117,7 +117,6 @@ from core.utils.seo_builders import (
|
|||
product_schema,
|
||||
website_schema,
|
||||
)
|
||||
from evibes.settings import DEBUG
|
||||
from payments.serializers import TransactionProcessSerializer
|
||||
|
||||
logger = logging.getLogger("django")
|
||||
|
|
@ -840,7 +839,7 @@ class OrderViewSet(EvibesViewSet):
|
|||
return Response(status=status.HTTP_404_NOT_FOUND, data={"detail": _(f"{name} does not exist: {uuid}")})
|
||||
|
||||
@action(detail=False, methods=["post"], url_path="buy_unregistered")
|
||||
@method_decorator(ratelimit(key="ip", rate="5/h" if not DEBUG else "888/h"))
|
||||
@method_decorator(ratelimit(key="ip", rate="10/h" if not settings.DEBUG else "888/h"))
|
||||
def buy_unregistered(self, request):
|
||||
serializer = BuyUnregisteredOrderSerializer(data=request.data)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
|
|
|
|||
Loading…
Reference in a new issue