Skip to main content

A python library for polling HTTP endpoints - batteries included!

Project description

Build Status

Coverage Status

httsleep is a powerful polling library for Python.


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}
   response = httsleep(
       'http://myendpoint/jobs/1', until, alarms=alarms,
except Alarm as e:
    print "Response was:", e.response
    print "Alarm condition that matched was:", e.alarm

Translated into English, this means:

  • Poll http://myendpoint/jobs/1 – at most 20 times – until
    • it returns a status code of 200
    • AND the status key in its response has the value OK
  • but raise an alarm if
    • the status key has the value ERROR
    • OR the status key has the value UNKNOWN AND the owner key has the value Chris AND the function is_job_really_dying returns True
    • OR the status code is 404


pip install httsleep


pip install -e .
pip install -r test-requirements.txt

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for httsleep, version 0.3.1
Filename, size File type Python version Upload date Hashes
Filename, size httsleep-0.3.1-py2.py3-none-any.whl (6.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size httsleep-0.3.1.tar.gz (24.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page