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 details)
Built Distribution
File details
Details for the file api_limit-0.0.2.tar.gz
.
File metadata
- Download URL: api_limit-0.0.2.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c9419046209999b3949a4c4ed80731333fe8e8c73179ac5ca10b7a801c81f77 |
|
MD5 | 69fdc9553b32731364fb154a3d285430 |
|
BLAKE2b-256 | 34d6021f1814f961fef268a368d6ce080a0be6cd8abadb6f602fc41c1b5a586c |
File details
Details for the file api_limit-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: api_limit-0.0.2-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ede1d3f13837abeb440f4515fd2ee9750c17eb21f22599073285c84a4d5e5ed |
|
MD5 | 706f8a0cf2460e31f29309bc68fbe203 |
|
BLAKE2b-256 | 3ab8089799854f551c021564e23c272d96cad80ade4edaf1a01dc07697b1c260 |