A Python Based API RateLimiter
Project description
How to Run
from apirlpy import ratelimiter as APIRL
#Import the Function
# Checking rate limit for a specific IP
CoolDown=APIRL(IP_Adrs="127.0.0.1", #IP address ofthe Client
#_______________________________________________________________
Cleaning=False, #To Enable the Ip Address Cleaning
CleaningFreq=80,# The Frequency at which the cleaning shoudl occur
AutoUpdate=False, #If you want to update the Data only after a certain time to reduce I/O operations
UpdateFreq=70, #(value in sec) of auto update
CooldownTime=20, #Amount of time differnce the Clients last vist shoudld
# exced for the IP address cleaner to remove the data
# *** FOR JSON AND SQL Format only ***
#If passed to "no stograge" option then this arguments will not be passed to the ratelimiter
#_______________________________________________________________
AllowedFreq=8, #The Number of Fair attempts the Client can send the request to the server
ResetTime=8, # After the Client is denied the access , how much time
#they need to wait to get the access again
Filename="Test", # The file name to store the data
Format="sql", # The File extenstion type which the ratelimiter is going to use to store the data
# Extensions available are : sql to use sqllite , json to use json format and "None" for No storage option
# If nothing is mentioned then the data will not be stored
FolderPath=None # The path at which u want to store this results
)
if CoolDown == 1: #The Client can access the API
print( "You are a Valid user")
else: # the Request is denied
print( f"You need to wait {CoolDown}")
**This is a test code **
The Code Return
- 1 : Means the Client Can Access the API
- other than 1: Means the Client Need to wait for the access of the API
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
apirlpy-0.1.5.tar.gz
(8.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
apirlpy-0.1.5-py3-none-any.whl
(10.5 kB
view details)
File details
Details for the file apirlpy-0.1.5.tar.gz.
File metadata
- Download URL: apirlpy-0.1.5.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad2e3fd144b9d6913cc387635729cbf5c423fd965a07d4a817a74507e9733392
|
|
| MD5 |
1b58ed527bd5c2cbed45c9e123086e5d
|
|
| BLAKE2b-256 |
408fc20bee761d2b3b90704376841336937c93eafcc787ac7628260b96b764bc
|
File details
Details for the file apirlpy-0.1.5-py3-none-any.whl.
File metadata
- Download URL: apirlpy-0.1.5-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
493d36dd3007e371af912df7edff72e402f099397dc8af75a1a9f2b7879d8af4
|
|
| MD5 |
1f410102b756f0d0bda23a37bb28b843
|
|
| BLAKE2b-256 |
c7a194ecd6ed869ca110311bf634ce2f98d94b949e4c993b46bae1dbebd50896
|