-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limit requests per hour #96
base: main
Are you sure you want to change the base?
Conversation
@tjasmith Why add a whole new module when you can simply do it with drf throttling? |
@Ugtan I decided to go on with django rate limit because it can be used on normal django views(which is the view on which it was supposed to be implemented.) I read about django rest framework throttling, but it didn't suit my needs(adding this to a normal django view), while the module which I choose did. |
Will this limit the rate on all requests or just the license submittal? The request I'm most concerned about is the check license. It would be good to limit all of the requests that can be made through the API. |
@goneall |
@tjasmith Also, write tests to check whether this modal is actually shown or not. You can use selenium to automate these requests. |
Ok. Thanks for the hint. |
@goneall I have limited the rate on all django rest framework apis, and on the following post requests:
@rtgdk I have written tests for the return of the requests using django's RequestFactory(to be able to simulate that the rate limit has been reached). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good to me. There are some changes in the white space which is causing some extra diffs. Are these necessary? I'm concerned it may create more merge conflicts.
@tjasmith In the test, you should send 100 request from selenium(either one by one or a bunch of them in parallel [In different tabs/windows of the browser]). The test you have written tests whether the view function is returning the correct error or not. You can keep this test. But add the selenium test to test whether this error is shown in real or not on the UI. |
@rtgdk Ok, On it. |
Fixes: #4
The license sumission is reduced to 100 per hour by a particular user.
When the limit is reached, the modal below is shown.