Skip to content

Instantly share code, notes, and snippets.

View purple4reina's full-sized avatar
💜

Rey Abolofia purple4reina

💜
View GitHub Profile
class throttle(object):
"""
Decorator that prevents a function from being called more than once every
time period. If called too soon, RuntimeError is raised.
To create a function that cannot be called more than once a minute:
@throttle(minutes=1)
def my_fun():
pass