To keep the old heart ticking
Project description
Pace Maker
There are times in your life when you have to call legacy api's that can handle like 2 reqs/sec. There is no point hammering the old man and killing him.
This library will help you pace calls to the old man, so his heart keeps ticking.
Combining this library with backoff(https://github.com/litl/backoff) can do wonders.
Install
python3 -m pip install pacemaker
Usage
from pacemaker import pace_me
# Function that will yield data that the process function needs
def data_gen(n=3):
for i in range(n):
yield [x for x in range(n)]
# Will make 3 requests to that url/sec using 1 token everytime process method is called. What data_gen function yields should be the first argument
@pace_me(data_gen, rate_per_second=3, n=6)
def process(data, url):
r = requests.post(url, data=data)
Run tests
- All tests (
docker-compose run --rm test)
Release
- Add PYPI_API_TOKEN env variable in circle
- TWINE_PASSWORD used pypi login password which is bad
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pacemaker-0.2.8.tar.gz.
File metadata
- Download URL: pacemaker-0.2.8.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.1.2 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad143b7e4d51743167da41778441124c121591a198a4579d802914e657edc568
|
|
| MD5 |
4ca7ffd94c4eedc924cc7664f02aa6dc
|
|
| BLAKE2b-256 |
b491a264a6bba77669150acc72e334d55a2f8cca118d722ac5250be64dd272e9
|
File details
Details for the file pacemaker-0.2.8-py3-none-any.whl.
File metadata
- Download URL: pacemaker-0.2.8-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.1.2 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a94ecd59d00913b8ab54fb7237294ebcc9f2bccdd87306bdf2c224a47142ee7
|
|
| MD5 |
a953d3aee7b804287f0fcfd9d32de1a6
|
|
| BLAKE2b-256 |
d4c7331796e6ddae6e4ba66fedc85f387048c1584a3165ea94db6a659da77840
|