A library for buffering function calls
Project description
pyfuncbuffer
A simple to use decorator to buffer function calls.
Install
$ pip install pyfuncbuffer
Example usage
Let's say you have a scraper, and don't want sites to timeout you.
You can use the @buffer()
wrapper to make your function calls buffered!
from pyfuncbuffer import buffer
# A function you want to buffer
@buffer(seconds=0.5, random_delay=0.5)
def scrape_link(url) -> []: ...
links = scrape_link("https://example.org")
while True:
link = links.pop(link)
links.append(scrape_link(link))
The @buffer()
wrapper works both for regular, and class functions!
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
pyfuncbuffer-0.1.1.dev0.tar.gz
(14.2 kB
view hashes)
Built Distribution
Close
Hashes for pyfuncbuffer-0.1.1.dev0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29fc4425d30196950e718904fdbb9fd1c7f406df7e821f61c0c6d5cebf881052 |
|
MD5 | 15666d67f8361579cbda5b5e8216a72a |
|
BLAKE2b-256 | c06d920a210f8a454af4d74aefcdb29764a918f28f2d31b9660c7726272919a3 |