httsleep
|Build Status|
|Coverage Status|
httsleep is a powerful polling library for Python.
Idea
Set your success conditions, set a few alarms, and get polling!
::
until = {
'status_code': 200,
'jsonpath': [{'expression': 'status', 'value': 'OK'}]
}
alarms = [
{'json': {'status': 'ERROR'}},
{'jsonpath': [{'expression': 'status', 'value': 'UNKNOWN'},
{'expression': 'owner', 'value': 'Chris'}],
'callback': is_job_really_failing},
{'status_code': 404}
]
try:
response = httsleep(
'http://myendpoint/jobs/1', until, alarms=alarms,
max_retries=20)
except Alarm as e:
print "Response was:", e.response
print "Alarm condition that matched was:", e.alarm
Translated into English, this means:
Documentation
http://httsleep.readthedocs.io/
Installing
::
pip install httsleep
Testing
::
pip install -e .
pip install -r test-requirements.txt
py.test
.. |Build Status| image:: https://travis-ci.org/kopf/httsleep.svg?branch=master
:target: https://travis-ci.org/kopf/httsleep
.. |Coverage Status| image:: https://coveralls.io/repos/github/kopf/httsleep/badge.svg?branch=master
:target: https://coveralls.io/github/kopf/httsleep?branch=master