Skip to content

Commit e7c0565

Browse files
committed
Merge pull request #1007 from willkg/throttle-docs-fix-1006
Fix *Throttle class names in the docs
2 parents c23412b + 3fbb409 commit e7c0565

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

docs/api-guide/throttling.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ As with permissions, multiple throttles may be used. Your API might have a rest
1212

1313
Another scenario where you might want to use multiple throttles would be if you need to impose different constraints on different parts of the API, due to some services being particularly resource-intensive.
1414

15-
Multiple throttles can also be used if you want to impose both burst throttling rates, and sustained throttling rates. For example, you might want to limit a user to a maximum of 60 requests per minute, and 1000 requests per day.
15+
Multiple throttles can also be used if you want to impose both burst throttling rates, and sustained throttling rates. For example, you might want to limit a user to a maximum of 60 requests per minute, and 1000 requests per day.
1616

1717
Throttles do not necessarily only refer to rate-limiting requests. For example a storage service might also need to throttle against bandwidth, and a paid data service might want to throttle against a certain number of a records being accessed.
1818

@@ -44,7 +44,7 @@ You can also set the throttling policy on a per-view or per-viewset basis,
4444
using the `APIView` class based views.
4545

4646
class ExampleView(APIView):
47-
throttle_classes = (UserThrottle,)
47+
throttle_classes = (UserRateThrottle,)
4848

4949
def get(self, request, format=None):
5050
content = {
@@ -55,7 +55,7 @@ using the `APIView` class based views.
5555
Or, if you're using the `@api_view` decorator with function based views.
5656

5757
@api_view('GET')
58-
@throttle_classes(UserThrottle)
58+
@throttle_classes(UserRateThrottle)
5959
def example_view(request, format=None):
6060
content = {
6161
'status': 'request was permitted'
@@ -72,22 +72,22 @@ The throttle classes provided by REST framework use Django's cache backend. You
7272

7373
## AnonRateThrottle
7474

75-
The `AnonThrottle` will only ever throttle unauthenticated users. The IP address of the incoming request is used to generate a unique key to throttle against.
75+
The `AnonRateThrottle` will only ever throttle unauthenticated users. The IP address of the incoming request is used to generate a unique key to throttle against.
7676

7777
The allowed request rate is determined from one of the following (in order of preference).
7878

79-
* The `rate` property on the class, which may be provided by overriding `AnonThrottle` and setting the property.
79+
* The `rate` property on the class, which may be provided by overriding `AnonRateThrottle` and setting the property.
8080
* The `DEFAULT_THROTTLE_RATES['anon']` setting.
8181

82-
`AnonThrottle` is suitable if you want to restrict the rate of requests from unknown sources.
82+
`AnonRateThrottle` is suitable if you want to restrict the rate of requests from unknown sources.
8383

8484
## UserRateThrottle
8585

86-
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. Unauthenticated requests will fall back to using the IP address of the incoming request to generate a unique key to throttle against.
86+
The `UserRateThrottle` 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. Unauthenticated requests will fall back to using the IP address of the incoming request to generate a unique key to throttle against.
8787

8888
The allowed request rate is determined from one of the following (in order of preference).
8989

90-
* The `rate` property on the class, which may be provided by overriding `UserThrottle` and setting the property.
90+
* The `rate` property on the class, which may be provided by overriding `UserRateThrottle` and setting the property.
9191
* The `DEFAULT_THROTTLE_RATES['user']` setting.
9292

9393
An API may have multiple `UserRateThrottles` in place at the same time. To do so, override `UserRateThrottle` and set a unique "scope" for each class.
@@ -113,11 +113,11 @@ For example, multiple user throttle rates could be implemented by using the foll
113113
}
114114
}
115115

116-
`UserThrottle` is suitable if you want simple global rate restrictions per-user.
116+
`UserRateThrottle` is suitable if you want simple global rate restrictions per-user.
117117

118118
## ScopedRateThrottle
119119

120-
The `ScopedThrottle` class can be used to restrict access to specific parts of the API. This throttle will only be applied if the view that is being accessed includes a `.throttle_scope` property. The unique throttle key will then be formed by concatenating the "scope" of the request with the unique user id or IP address.
120+
The `ScopedRateThrottle` class can be used to restrict access to specific parts of the API. This throttle will only be applied if the view that is being accessed includes a `.throttle_scope` property. The unique throttle key will then be formed by concatenating the "scope" of the request with the unique user id or IP address.
121121

122122
The allowed request rate is determined by the `DEFAULT_THROTTLE_RATES` setting using a key from the request "scope".
123123

0 commit comments

Comments
 (0)