Installing
pip3 install throttle
Simple Usage
import time
import throttle
# limit to 3 calls
# allow more every 1 second
@throttle.wrap(1, 3)
def aesthetic(*values):
return ' '.join(values).upper()
for index in range(10):
result = aesthetic('beautiful')
success = not result is throttle.fail
print(index, success)
time.sleep(0.23)
Complex Usage
import time
import random
import throttle
# allow more every 1 second
delay = 1
# limit to 3 calls
limit = 3
# only check values less than 5 against the limit
key = lambda value: value < 5
# or Static()
valve = throttle.Valve()
# make some quick calls
for index in range(30):
item = random.randrange(0, 8)
allow = valve.check(delay, limit, item, key = key)
print(item, allow)
time.sleep(0.23)
Links
Metadata
Release files for throttle 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| throttle-0.2.2.tar.gz | 4.0 kB | Without provenance | Details for throttle-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| throttle-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for throttle-0.2.2-py3-none-any.whl |
Total release size: 9.0 kB
Release files / throttle-0.2.2.tar.gz
| Download URL | throttle-0.2.2.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c949b0ae118c63e9e1be3e927d7ecdc9c46231248374d4d1cab95123e380e0c
|
|
BLAKE2b-256 checksum How to use checksums |
935db2ccc39e665ee189eb465c1e637337150e72a65a160dbfcefd0b7b124e94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.8.1
|
Release files / throttle-0.2.2-py3-none-any.whl
| Download URL | throttle-0.2.2-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a8bd279e062190708fc1df2bbf0aea5f8460bf7893114ebdb2789ce7a286e9fe
|
|
BLAKE2b-256 checksum How to use checksums |
66b752f82631b668ec9f0fe28322758d78e75334added5b012362393e5cb7849
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.8.1
|
Security for throttle 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.