Description
An algorithm used in packet switched computer networks and telecommunications networks to check that data transmissions, in the form of packets, conform to defined limits on bandwidth and burstiness.
Where to use
- Rate limiting.
Real World Example
API Gateway gives each user a bucket of 10 tokens. Each request takes 1.
Code Example
class TokenBucket:
def __init__(self):
pass
def execute(self):
print('Executing Token Bucket')
