This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, but | |
will sleep until it can be called: | |
@throttle(minutes=1) | |
def foo(): | |
pass |