-
Notifications
You must be signed in to change notification settings - Fork 48
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
[api] Added Scoped Throttling #34 #81
[api] Added Scoped Throttling #34 #81
Conversation
@nemesisdesign, @atb00ker have a look 🤔 |
047a4e4
to
4cc0d13
Compare
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.
2 initial comments:
e560c02
to
4d6e446
Compare
@nemesisdesign , @atb00ker |
tests/openwisp2/settings.py
Outdated
@@ -85,6 +85,7 @@ | |||
STATIC_URL = '/static/' | |||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' | |||
OPENWISP_USERS_AUTH_API = True | |||
OPENWISP_IPAM_API = True |
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.
let's avoid this setting, some features of the API is used by the admin as well so it doesn't make sense to turn it off
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.
Okay
openwisp_ipam/apps.py
Outdated
@@ -9,7 +10,13 @@ class OpenWispIpamConfig(ApiAppConfig): | |||
name = 'openwisp_ipam' | |||
verbose_name = 'IPAM' | |||
|
|||
API_ENABLED = getattr(settings, 'OPENWISP_IPAM_API') |
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.
simply set this to True
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.
Sure
4d6e446
to
55cc03f
Compare
@nemesisdesign I have done the changes as requested have a look. |
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.
Thanks @ManishShah120 👍
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.
I realized something important.
We're not documenting how to change the default throttling settings.
Can it be done without having to modify the code of openwisp-ipam? I mean just by adding something in settings.py. Can you double check this please and let me know?
I think I'll have to open an issue for fw-upgrader too since it should be done there too.
PS: for the commit message, use this:
[feature] Added throttling of API requests #34
Okay, @nemesisdesign I'll check and see if it can be done and let you know.
Yeah, I guess so |
55cc03f
to
8376c9a
Compare
Hey, @nemesisdesign I confirmed in other openwisp modules and found no sign of documentation related to changing of default throttling settings, So it will be a good idea to introduce in it. And about the modification of the default throttling settings, yes it can be done but in that case, we will need to move this portion of the code from
to |
This method looks good to me! 😄 |
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.
@ManishShah120 question:
- if you leave the code as is
- then add the setting
REST_FRAMEWORK_SETTINGS
insettings.py
as you described (just without usingdefault_or_test
which is not meant to be used during configuration)
Does the override work?
Yes, @nemesisdesign, It does override's the previous codes implemented in |
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.
Yes, @nemesisdesign, It does override's the previous codes implemented in
apps.py
and takes effect whatever value is provided in thesettings.py
file and if we comment out thisREST_FRAMEWORK
from settings.py then again it takes effect whatever is implemented inapps.py
file.
Ok @ManishShah120, thanks for double checking, please can you add a few lines in the README that explain how to override the throttling settings?
8376c9a
to
043a06d
Compare
@nemesisdesign , Is this Okay. |
043a06d
to
b9207f5
Compare
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.
Quick look, LGTM! 😄
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.
Great work @ManishShah120 👍
closses #34