fix: Rate limiter to allow kwargs
This commit is contained in:
parent
0262210d1f
commit
9781fb758f
1 changed files with 2 additions and 2 deletions
|
|
@ -103,7 +103,7 @@ def rate_limit(key: str, limit: Union[int, Callable] = 5, seconds: int= 24*60*60
|
|||
def wrapper(*args, **kwargs):
|
||||
# Do not apply rate limits if method is not opted to check
|
||||
if methods != 'ALL' and frappe.request.method.upper() not in methods:
|
||||
return frappe.call(fun, **frappe.form_dict)
|
||||
return frappe.call(fun, **frappe.form_dict or kwargs)
|
||||
|
||||
_limit = limit() if callable(limit) else limit
|
||||
|
||||
|
|
@ -118,6 +118,6 @@ def rate_limit(key: str, limit: Union[int, Callable] = 5, seconds: int= 24*60*60
|
|||
if value > _limit:
|
||||
frappe.throw(_("You hit the rate limit because of too many requests. Please try after sometime."))
|
||||
|
||||
return frappe.call(fun, **frappe.form_dict)
|
||||
return frappe.call(fun, **frappe.form_dict or kwargs)
|
||||
return wrapper
|
||||
return ratelimit_decorator
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue