Skip to content

Instantly share code, notes, and snippets.

@anders
anders / throttle.py
Last active August 29, 2015 13:57 — forked from ChrisTM/throttle.py
class throttle(object):
"""
Decorator that prevents a function from being called more than once every
time period.
To create a function that cannot be called more than once a minute:
@throttle(minutes=1)
def my_fun():
pass