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
Metadata
Release files for uprate 0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| uprate-0.4.tar.gz | 12.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| uprate-0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.7 kB
Release files / uprate-0.4.tar.gz
| Download URL | uprate-0.4.tar.gz |
|---|---|
| Size | 12.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fb7d556793ed6de9116a0f7433a4bb5d01f710cd171e4ecb4b91539bb27cbaad
|
|
BLAKE2b-256 checksum How to use checksums |
968670f0ee704eb38be5ba9242ba5d2b21b7f99de16a3a10cb81207802983081
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / uprate-0.4-py3-none-any.whl
| Download URL | uprate-0.4-py3-none-any.whl |
|---|---|
| Size | 16.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
83be48b1468a326c14b0404bb51d0199f84a6b98839e16bd4e5e771b69aa979d
|
|
BLAKE2b-256 checksum How to use checksums |
cfc11da9aa192f342f4a84cad83ebb7a216284113ac394b793944db39c8cebb1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|