Skip to main content

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.4.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

apirlpy-0.1.4-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file apirlpy-0.1.4.tar.gz.

File metadata

  • Download URL: apirlpy-0.1.4.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

Hashes for apirlpy-0.1.4.tar.gz
Algorithm Hash digest
SHA256 779dc33a29eb10abb302767cc7bb82ff949a3e5167646c1f3eb3e0e928f13217
MD5 16c5b6856e2011123da8901d9d30445b
BLAKE2b-256 0b4d8383064f11cf3c7c776cba32c09f9237d853130e8015e75e9aed5fec5fcc

See more details on using hashes here.

File details

Details for the file apirlpy-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: apirlpy-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for apirlpy-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9982dc92b88726faa52e3a700a8da33f9f013a5cc78a14913424617fdc938bcc
MD5 db2414f59c71262346e1f9a6c87108cf
BLAKE2b-256 03e0330ee34b7c8a2503a28cb99bc65e913a8da2ad42f4b3bcf1e724c2fd6f06

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page