A simple throttling controller
Project description
throttle-controller
Usage
from throttle_controller import SimpleThrottleController
throttle = SimpleThrottleController(default_cooldown_time=3.0)
throttle.wait_if_needed("http://example.com/path/to/api")
throttle.record_use_time_as_now("http://example.com/path/to/api")
... # requests
throttle.wait_if_needed("http://example.com/path/to/api") # wait 3.0 seconds
throttle.record_use_time_as_now("http://example.com/path/to/api")
Caution
Currently this package supports only to use in single thread / single process use-cases.
LICENSE
The 3-Clause BSD License. See also LICENSE file.
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
File details
Details for the file throttle-controller-0.0.1.zip
.
File metadata
- Download URL: throttle-controller-0.0.1.zip
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e2c74f7b36c2a2b8bba23a99931af0169a1a151eac3d5d00e1d54f2532cf4c3 |
|
MD5 | 76e41153525e328df949700fed9cedf9 |
|
BLAKE2b-256 | 063cce3df3a82606f08ffbbe50f70da888381d611d9e219e778d38df400ad466 |