jsocol / django-ratelimit

Cache-based rate-limiting for Django
https://django-ratelimit.readthedocs.io/en/latest/
Other
1.07k stars 187 forks source link

Add support for Django REST Framework's Request.data #302

Closed ronanboiteau closed 4 months ago

ronanboiteau commented 1 year ago

Support rate limiting on the key data for use with Django REST Framework's Request.data

muhammedattif commented 7 months ago

I think we need this change as soon as possible, because most of developers use this package with DRF @jsocol

Tom5421 commented 6 months ago

Hey, do we have an ETA on when this will be available?

Tom5421 commented 5 months ago

Hey @muhammedattif @ronanboiteau would either of you like to fork this repo and add this feature?

It looks like the owner has no intention to merge any of these requests.

I would do it myself, but I am not that confident with Git.

ronanboiteau commented 5 months ago

UPDATE: Fork published to PyPi: djangorestframework-ratelimit

Original comment:


Hey @muhammedattif @ronanboiteau would either of you like to fork this repo and add this feature?

It looks like the owner has no intention to merge any of these requests.

I would do it myself, but I am not that confident with Git.

Hey @Tom5421!

As a temporary solution you could use the branch v4.1.0-with-drf-support on @guestready's fork. It's basically the changes from this pull request on a branch with no other commits beyond the tag v4.1.0. From our requirements.txt:

git+https://github.com/guestready/django-ratelimit.git@v4.1.0-with-drf-support#egg=django-ratelimit

As a more permanent solution we could publish the fork to PyPi as something like djangorestframework-ratelimit, if @jsocol doesn't think we should merge this into the original package.

Tom5421 commented 5 months ago

Thanks for that @ronanboiteau.

I agree, a more permeant solution would be great.

ronanboiteau commented 5 months ago

Hey @Tom5421 @muhammedattif!

I created the fork djangorestframework-ratelimit and published v1.0.0 to PyPi: https://pypi.org/project/djangorestframework-ratelimit/

It's based on django-ratelimit v4.1.0 and it contains the changes suggested in this pull request + the changes from https://github.com/jsocol/django-ratelimit/pull/301 + various changes related to the package management / documentation. You can check the exact diff here.

Tom5421 commented 5 months ago

Perfect, thank you for doing this!

ronanboiteau commented 4 months ago

Moved to fork djangorestframework-ratelimit

Can be installed from PyPi: https://pypi.org/project/djangorestframework-ratelimit/

DmytroLitvinov commented 4 months ago

Maybe we can add support in the package like checking if djangorestframework is installed, then we add support for data?