API rate limit decorator
Project description
Api_Limit
About
It's Simple Middeleware implemented with tocken bucket algorithm to manage the number of api per seconds.
Usage
import time
from api_limit import api_limit
import requests
@api_limit(max_api_call=2)
def call_api(url):
response = requests.get(url)
if response.status_code != 200:
raise Exception('API response: {}'.format(response.status_code))
return response
We can also specify wheter overflow of call should return the response or simply avoide the call without acknowledgement.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
api_limit-0.0.2.tar.gz
(2.5 kB
view hashes)
Built Distribution
Close
Hashes for api_limit-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ede1d3f13837abeb440f4515fd2ee9750c17eb21f22599073285c84a4d5e5ed |
|
MD5 | 706f8a0cf2460e31f29309bc68fbe203 |
|
BLAKE2b-256 | 3ab8089799854f551c021564e23c272d96cad80ade4edaf1a01dc07697b1c260 |