Skip to main content

A library for buffering function calls

Project description

pyfuncbuffer

Build status

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


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)

Uploaded Source

Built Distribution

pyfuncbuffer-0.1.dev0-py3-none-any.whl (16.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page