Skip to content

Instantly share code, notes, and snippets.

View ColinShark's full-sized avatar
🦈
Being Sharky :3

ColinShark ColinShark

🦈
Being Sharky :3
View GitHub Profile
@ColinShark
ColinShark / rateLimitDecorator.py
Last active February 20, 2022 00:08 — forked from gregburek/rateLimitDecorator.py
Rate limiting function calls with Python Decorators [Py3]
import time
def rate_limit(max_per_second=2):
min_interval = 1.0 / float(max_per_second)
def decorate(func):
last_time_called = [0.0]
def rate_limited_func(*args, **kargs):