You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Documentation available at [Read the Docs](https://polling2.readthedocs.io)
11
+
11
12
Polling2 is a powerful python utility used to wait for a function to return a certain expected condition.
12
13
13
14
Some possible uses cases include:
@@ -20,15 +21,15 @@ Polling2 is handy for getting rid of all that duplicated polling-code. Often, ap
20
21
21
22
Polling2 is a fork of the original [polling](https://github.com/justiniso/polling). It was forked when the original maintainer failed to respond to issues or PRs.
22
23
23
-
Polling2 is ++under active development++. Would you like to see a particular feature? Ask and thou shall recieve.
24
+
Polling2 is _under active development_. Would you like to see a particular feature? Ask and thou shall recieve.
24
25
25
-
# Installation
26
+
##Installation
26
27
27
28
```
28
29
pip install polling2
29
30
```
30
31
31
-
# Development installation
32
+
##Development installation
32
33
33
34
```shell
34
35
# install lib, but use system links from the repo into sitepackages.
@@ -39,30 +40,7 @@ python setup.py test
39
40
pytest tests
40
41
```
41
42
42
-
# Examples
43
-
44
-
### Example: Poll every minute until a url returns 200 status code
If you are creating a new cloud provider instance (e.g. waiting for an EC2 instance to come online), you can continue to poll despite getting ConnectionErrors:
ignore_exceptions=(ValueError), # Only ignore the ValueError.
186
-
log_error=logging.WARNING# Ignored errors should be passed to the logger at warning level.
187
-
)
188
-
exceptRuntimeErroras _e:
189
-
print"Un-ignored %r"% _e``
190
-
```
191
-
192
-
# Future extensions
193
-
194
-
- Add poll_killer(). Specify a hard timeout so that if the function being polled blocks and doesn't return, poll_killer() will raise a timeout.
195
-
- Add an option to do via multiprocessing.
196
-
- Add an option to do via threading - probably the default option.
197
-
- Add poll_chain(). Have reason to poll a bunch of functions in a row? poll_chain() allows you to chain a bunch of polling functions together.
198
-
- Allow step to be specificed as0, so that we can poll continously. (Perhaps it's best to write a poll_continous() method.)
199
-
200
-
# Release notes
201
-
202
-
## 0.4.5
203
-
-'Begin poll(*)' message is logged when poll() is called. Hopefully this means the user doesn't feel the need to write a message before
204
-
every call to poll() to indicate how long the poll() might take.
205
-
206
-
## 0.4.4
207
-
- Add is_value() function. A function that allows a user to easily build a custom checker, like is_truthy(), but forany value.
208
-
209
-
## 0.4.3
210
-
- Add log_error parameter to the poll signature. Enables logging of ignored exceptions.
211
-
212
-
## 0.4.2
213
-
- Add log_value() decorator and log parameter to poll signature. Enables logging of return_values.
214
-
215
-
## 0.4.0
216
-
- Fixed polling function from waiting another sleep whenever the max_tries value has reached zero.
217
-
- Remove test-only dependencies from requirements to install the package.
218
-
- No longer testing on python 2.6. Add support for travis testing on python 3.6and pypy 3.5.
219
-
- Creation of polling2, forked from polling as previous maintainer seems to be ignoring issues and pull-requests.
220
-
- Remove ```*a, **k```from poll signature. This allows Type errors to be raised if caller spells arguments into correctly, making bugs easier to find.
221
-
222
-
## 0.3.0
223
-
224
-
- Support Python 3.4+
225
-
226
-
## 0.2.0
227
-
228
-
- Allow users to access a "last" attribute on the exceptions. This should hold the last evaluated value, which is the more common use case than getting the first value.
229
-
- Fix a bug that actually ran 1 more time than value specified by max_tries
230
56
231
-
## 0.1.0
57
+
There are [more examples](https://polling2.readthedocs.io/en/latest/examples) in the documentation.
232
58
233
-
- First version
59
+
## API and user guide at [Read the Docs](https://polling2.readthedocs.io)
234
60
235
-
# Contributors
236
-
- Justin Iso (original creator)
237
-
- Donal Mee
61
+
[](https://polling2.readthedocs.io)
0 commit comments