Skip to main content

Build Status PyPI PyPI HitCount

polling2

Never write another polling function again!

Documentation available at Read the Docs

Polling2 is a powerful python utility used to wait for a function to return a certain expected condition.

Some possible uses cases include:

  • Wait for API response to return with code 200
  • Wait for a file to exist (or not exist)
  • Wait for a thread lock on a resource to expire

Polling2 is handy for getting rid of all that duplicated polling-code. Often, applications require retrying until the correct response is returned. Why re-implement the ability to poll again and again? Use Polling2!

Polling2 is a fork of the original polling. It was forked when the original maintainer failed to respond to issues or PRs.

Polling2 is under active development. Would you like to see a particular feature? Ask and thou shall recieve.

Installation

pip install polling2

Development installation

# install lib, but use system links from the repo into sitepackages.
python setup.py develop
# install test dependenices.
python setup.py test
# run the tests
pytest tests

Example:

# This call will wait until the file exists, checking every 0.1 seconds and stopping after 3 seconds have elapsed
file_handle = polling2.poll(
    lambda: open('/tmp/myfile.txt'),
    ignore_exceptions=(IOError,),
    timeout=3,
    step=0.1)

# Polling will return the value of your polling function, so you can now interact with it
file_handle.close()

There are more examples in the documentation.

API and user guide at Read the Docs

Read the Docs

Metadata

Release files for polling2 0.4.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for polling2 0.4.6
File Size Uploaded
polling2-0.4.6.tar.gz 6.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for polling2 0.4.6
File Interpreter ABI Platform
polling2-0.4.6-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 12.6 kB

Release files / polling2-0.4.6.tar.gz

Download URL polling2-0.4.6.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6fd676640c4575b3d94888b34086cf64ad2ce6b3314107ecd42add2be8224fe0
BLAKE2b-256 checksum
How to use checksums
e742ec2075382da30550363bf61782e0f14ad5a2c601c0e09f83e962723f6c76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.13

Release files / polling2-0.4.6-py2.py3-none-any.whl

Download URL polling2-0.4.6-py2.py3-none-any.whl
Size 6.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
003facc3b47ac1e03847610c484409315bc2b2496ff48d0f05114e833cc27a5f
BLAKE2b-256 checksum
How to use checksums
6e9e395ba85d5bcf502b8fe93378efba85e557e70d10407c294e27b5f56bd898
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.13

Release history Release notifications | RSS feed

0.5.0

2 release files

0.4.7

2 release files

This release

0.4.6 This release

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.1

2 release files

0.4.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page