Skip to main content

A Bursty Ratelimiter for Python. It allows two Limiters with different rates to be combined. Started as a limiter for my SpaceTradersAPI client.

Project description

BurstyLimiter

This is a library to help with Burst Ratelimits. I needed to ratelimit my requests for an API game called SpaceTradersAPI, so i wrote this. Originally there was a limit of 2 requests per second + 10 requests per ten seconds.

Small disclaimer: I am now a part of the Team behind SpaceTradersAPI.

Usage

For the usage look at the code below. rate_limited_function has a ratelimit of 2/second plus 10 per 10 seconds, just like what i needed for the game.

pip install burstylimiter
from burstylimiter import Limiter, BurstyLimiter

@BurstyLimiter(Limiter(2, 1), Limiter(10, 10))
def rate_limited_function():
    print("I am Ratelimited")

Tests

Each tests needed its own file because pytest messes with the timing if they are not.

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

burstylimiter-0.1.1.tar.gz (25.8 kB view details)

Uploaded Source

Built Distribution

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

burstylimiter-0.1.1-py3-none-any.whl (26.8 kB view details)

Uploaded Python 3

File details

Details for the file burstylimiter-0.1.1.tar.gz.

File metadata

  • Download URL: burstylimiter-0.1.1.tar.gz
  • Upload date:
  • Size: 25.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.3 Linux/6.8.0-51-generic

File hashes

Hashes for burstylimiter-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a4a6ecefcff75178466bde73e7fa0afd258f150f4f1bf9f08daeec98462667f6
MD5 1a14fb6eb4461314f5bdba9b2785628e
BLAKE2b-256 66abf657b5dca2f973934c781575e0a1228a319a10b00030dce458bca35d7867

See more details on using hashes here.

File details

Details for the file burstylimiter-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: burstylimiter-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 26.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.3 Linux/6.8.0-51-generic

File hashes

Hashes for burstylimiter-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f4b000907075824c17879b484d190502d1e243450501cebec8c9b387567c78d3
MD5 b89ea6fb4ba88f0de256f7318dec5ca0
BLAKE2b-256 0dd329453db73d27e71fc5359ad6679e4a6222aac7ee70183ea6b6b9d8e5c423

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