Skip to content

Instantly share code, notes, and snippets.

@ChrisTM
ChrisTM / throttle.py
Created June 21, 2013 21:33
Python decorator for throttling function calls.
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