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.dev0.tar.gz
(14.2 kB
view hashes)
Built Distribution
Close
Hashes for pyfuncbuffer-0.1.dev0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1525e32aed313816ff3e17d8158e50f43cbd9614e6611e1fc2778018cd8cce1 |
|
MD5 | f7c364629512cb660bc82bb8492ad835 |
|
BLAKE2b-256 | b84f818d1cdf2216771aea51cfcf48fd308c7adaf37b13bc3f882bd83a4dcce6 |