From 2241d4ad029eb27176ef792efa2b9faca6653843 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=2E=C3=87a=C4=9Flar=20Onur?= Date: Tue, 16 Nov 2010 16:42:52 -0500 Subject: [PATCH] add whitelist --- aspects/ratelimitaspects.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aspects/ratelimitaspects.py b/aspects/ratelimitaspects.py index 78548c2..8be22e5 100644 --- a/aspects/ratelimitaspects.py +++ b/aspects/ratelimitaspects.py @@ -23,6 +23,8 @@ class BaseRateLimit(object): self.requests = 50 # Number of allowed requests in that time period self.expire_after = (self.minutes + 1) * 60 + self.whitelist = [] + def before(self, wobj, data, *args, **kwargs): # ratelimit_128.112.139.115_201011091532 = 1 # ratelimit_128.112.139.115_201011091533 = 14 @@ -33,7 +35,7 @@ class BaseRateLimit(object): api_method_name = wobj.name api_method_source = wobj.source - if api_method_source == None or api_method_source[0] == self.config.PLC_API_IP: + if api_method_source == None or api_method_source[0] == self.config.PLC_API_IP or api_method_source[0] in self.whitelist: return mc = memcache.Client(["%s:11211" % self.config.PLC_API_HOST]) -- 2.45.2