polling2
Never write another polling function again!
Documentation available at Read the Docs
You can install the package from Pypi
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
Metadata
Release files for polling2 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| polling2-0.5.0.tar.gz | 6.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| polling2-0.5.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 13.0 kB
Release files / polling2-0.5.0.tar.gz
| Download URL | polling2-0.5.0.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
90b7da82cf7adbb48029724d3546af93f21ab6e592ec37c8c4619aedd010e342
|
|
BLAKE2b-256 checksum How to use checksums |
049d6a560ab95e1b92dfce97321d8ffc9f20d352fa4b12a91525d4c575df1c74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.1
|
Release files / polling2-0.5.0-py2.py3-none-any.whl
| Download URL | polling2-0.5.0-py2.py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
ad86d56fbd7502f0856cac2d0109d595c18fa6c7fb12c88cee5e5d16c17286c1
|
|
BLAKE2b-256 checksum How to use checksums |
a3dee5bf2556ebd6db12590788207575c7c75b1de62f5ddc8b4916b668e04e6b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.1
|