aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide/throttling.md
diff options
context:
space:
mode:
authorJamie Matthews2012-09-26 13:05:21 +0100
committerJamie Matthews2012-09-26 13:05:21 +0100
commit01770c53cd9045e6ea054f32b1e40b5d2ff7fe44 (patch)
tree657cb66f92d78add3b2f587754387832043168e6 /docs/api-guide/throttling.md
parentf6488cb0589d3b11fb8d831e00d1389f3fff74b6 (diff)
parent09a445b257532be69ffab69a3f62b84bfa90463d (diff)
downloaddjango-rest-framework-01770c53cd9045e6ea054f32b1e40b5d2ff7fe44.tar.bz2
Merge branch 'restframework2' of git://github.com/tomchristie/django-rest-framework into improved-view-decorators
* 'restframework2' of git://github.com/tomchristie/django-rest-framework: (56 commits) Bits of cleanup Add request.QUERY_PARAMS Add readonly 'id' field Tweak browseable API Don't display readonly fields Fix some bits of serialization Add csrf note Fix incorrect bit of tutorial Added tox.ini Tweak media_type -> accepted_media_type. Need to document, but marginally less confusing Tweak media_type -> accepted_media_type. Need to document, but marginally less confusing Tweak media_type -> accepted_media_type. Need to document, but marginally less confusing Clean up bits of templates etc Hack out bunch of unneccesary private methods on View class Clean up template tags Remove dumbass __all__ variables Remove old 'djangorestframework directories Change package name: djangorestframework -> rest_framework Dont strip final '/' Use get_script_prefix to play nicely if not installed at the root. ... Conflicts: rest_framework/decorators.py
Diffstat (limited to 'docs/api-guide/throttling.md')
-rw-r--r--docs/api-guide/throttling.md19
1 files changed, 9 insertions, 10 deletions
diff --git a/docs/api-guide/throttling.md b/docs/api-guide/throttling.md
index d1e34dcd..7861e9ba 100644
--- a/docs/api-guide/throttling.md
+++ b/docs/api-guide/throttling.md
@@ -29,10 +29,10 @@ If any throttle check fails an `exceptions.Throttled` exception will be raised,
The default throttling policy may be set globally, using the `DEFAULT_THROTTLES` and `DEFAULT_THROTTLE_RATES` settings. For example.
- API_SETTINGS = {
+ REST_FRAMEWORK = {
'DEFAULT_THROTTLES': (
- 'djangorestframework.throttles.AnonThrottle',
- 'djangorestframework.throttles.UserThrottle',
+ 'rest_framework.throttles.AnonThrottle',
+ 'rest_framework.throttles.UserThrottle',
)
'DEFAULT_THROTTLE_RATES': {
'anon': '100/day',
@@ -76,7 +76,7 @@ The allowed request rate is determined from one of the following (in order of pr
## UserRateThrottle
-The `UserThrottle` will throttle users to a given rate of requests across the API. The user id is used to generate a unique key to throttle against. Unauthenticted requests will fall back to using the IP address of the incoming request is used to generate a unique key to throttle against.
+The `UserThrottle` will throttle users to a given rate of requests across the API. The user id is used to generate a unique key to throttle against. Unauthenticted requests will fall back to using the IP address of the incoming request to generate a unique key to throttle against.
The allowed request rate is determined from one of the following (in order of preference).
@@ -95,7 +95,7 @@ For example, multiple user throttle rates could be implemented by using the foll
...and the following settings.
- API_SETTINGS = {
+ REST_FRAMEWORK = {
'DEFAULT_THROTTLES': (
'example.throttles.BurstRateThrottle',
'example.throttles.SustainedRateThrottle',
@@ -106,7 +106,7 @@ For example, multiple user throttle rates could be implemented by using the foll
}
}
-`UserThrottle` is suitable if you want a simple global rate restriction per-user.
+`UserThrottle` is suitable if you want simple global rate restrictions per-user.
## ScopedRateThrottle
@@ -124,16 +124,15 @@ For example, given the following views...
throttle_scope = 'contacts'
...
-
class UploadView(APIView):
throttle_scope = 'uploads'
...
...and the following settings.
- API_SETTINGS = {
+ REST_FRAMEWORK = {
'DEFAULT_THROTTLES': (
- 'djangorestframework.throttles.ScopedRateThrottle',
+ 'rest_framework.throttles.ScopedRateThrottle',
)
'DEFAULT_THROTTLE_RATES': {
'contacts': '1000/day',
@@ -149,4 +148,4 @@ To create a custom throttle, override `BaseThrottle` and implement `.allow_reque
Optionally you may also override the `.wait()` method. If implemented, `.wait()` should return a recomended number of seconds to wait before attempting the next request, or `None`. The `.wait()` method will only be called if `.check_throttle()` has previously returned `False`.
-[permissions]: permissions.md \ No newline at end of file
+[permissions]: permissions.md