Skip to main content

Ratelimits. Dumbified. A fully typed, simple ratelimit library.

Project description

A fully typed, simple ratelimit library.


About

Uprate is a robust, simple ratelimit library.
While providing a simple to use api, it is also highly scalable and provides absolute control for fine-tuning.
Hence, Uprate can be used in all stages of your app from prototyping to production! 🚀
Here is a simple example.

Why?

There are two ways ratelimits are implemented in python for server-side

  • Make everything from scratch
  • Use a framework dependent ratelimit library.

The problem in the first way is obvious, it's harder, consumes more time.
Using a framework dependent ratelimit library is more feasible, but often these libraries don't provide features like external stores, multiple ratelimits and manual key specification. While there are some awesome ratelimit libraries for framwork X, not everyone uses framework X 😕.

Ratelimits in client-sided coded also face similar problems. Often APIs enforce multiple ratelimits. Making a ratelimiter from scratch for your API wrapper or a small scale data collector takes up valuable dev time, which is why uprate aims to also provide tools for client-sided code.

Documentation

The documentation can be found at https://uprate.readthedocs.io/en/latest/

Getting Started

Installation

You can install the latest stable version from pypi by

pip install uprate

or you can install the dev version from github

pip install git+https://github.com/WizzyGeek/uprate.git@master#egg=uprate

Usage

import uprate

And you are good to go! 🤘

Example

Here is a simple example that demonstrates Uprate's Awesomeness.

import uprate

@uprate.ratelimit(1 / (uprate.Seconds(2) + uprate.Minutes(1)))
def limited():
    ...

limited()

try:
    # Within 62 seconds
    limited()
except uprate.RateLimitError:
    print("called function too fast")

And so much more!

Thanks to @someonetookmycode for the graphical assets
© WizzyGeek 2021

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

uprate-0.3.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

uprate-0.3-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file uprate-0.3.tar.gz.

File metadata

  • Download URL: uprate-0.3.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.1 Windows/10

File hashes

Hashes for uprate-0.3.tar.gz
Algorithm Hash digest
SHA256 e2c23ca50c70c4abfa51c995e753ff1793c66a24eef764441d114c54966bd986
MD5 524dde5bb4208bb7e3cf6200565f5ad9
BLAKE2b-256 b13cb8cefa99c333887683880665112af2d3377cf3dd4b18a9d7ba04580fa4aa

See more details on using hashes here.

File details

Details for the file uprate-0.3-py3-none-any.whl.

File metadata

  • Download URL: uprate-0.3-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.1 Windows/10

File hashes

Hashes for uprate-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 64d2af4dc4321cb5cc9adf66a1319d0d3a42f617bf17cec771290ae923465624
MD5 67587ac578a74087ab54a48de63b4730
BLAKE2b-256 acb9100217e903332d2e4954eecaee5cc8a43d281f29a47344ca66aef1f041a4

See more details on using hashes here.

Supported by

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