@@ -64,19 +64,19 @@ application = AppFactory.create_from_app_module(
6464The above is also a valid configuration for ` ThrottleModule ` registration if you want to work with config.
6565
6666** NOTE** : If you add the ` ThrottlerGuard ` to your application ` global_guards ` , then all the incoming requests will be throttled by default.
67- This can also be omitted in favor of ` @guards (ThrottlerGuard) ` .
67+ This can also be omitted in favor of ` @UseGuards (ThrottlerGuard) ` .
6868The global guard check can be skipped using the ` @skip_throttle() ` decorator mentioned later.
6969
70- Example with ` @guards (ThrottlerGuard) `
70+ Example with ` @UseGuards (ThrottlerGuard) `
7171``` python
7272# project_name/controller.py
73- from ellar.common import Controller, Guards
73+ from ellar.common import Controller, UseGuards
7474from ellar_throttler import throttle, ThrottlerGuard
7575
7676@Controller ()
7777class AppController :
7878
79- @Guards (ThrottlerGuard)
79+ @UseGuards (ThrottlerGuard)
8080 @throttle (limit = 5 , ttl = 30 )
8181 def normal (self ):
8282 pass
@@ -98,11 +98,12 @@ a class that is skipped.
9898
9999``` python
100100# project_name/controller.py
101- from ellar.common import Controller
101+ from ellar.common import Controller, UseGuards
102102from ellar_throttler import ThrottlerGuard, skip_throttle
103103
104104@skip_throttle ()
105- @Controller (guards = [ThrottlerGuard])
105+ @UseGuards (ThrottlerGuard)
106+ @Controller ()
106107class AppController :
107108
108109 def do_skip (self ):
@@ -168,7 +169,8 @@ class ThrottlerBehindProxyGuard(ThrottlerGuard):
168169# project_name/controller.py
169170from .throttler_behind_proxy import ThrottlerBehindProxyGuard
170171
171- @Controller (' ' , guards = [ThrottlerBehindProxyGuard])
172+ @Controller (' ' )
173+ @UseGuards (ThrottlerBehindProxyGuard)
172174class AppController :
173175 pass
174176```
0 commit comments