Skip to main content

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:

  • 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

Documentation

http://httsleep.readthedocs.io/

Installing

pip install httsleep

Testing

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

Metadata

Release files for httsleep 0.3.1

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

Source distribution (sdist)

Source distribution for httsleep 0.3.1
File Size Uploaded Provenance Actions
httsleep-0.3.1.tar.gz 24.8 kB Without provenance Details for httsleep-0.3.1.tar.gz

Built distribution (wheel)

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

Total release size: 31.6 kB

Release files / httsleep-0.3.1.tar.gz

Download URL httsleep-0.3.1.tar.gz
Size 24.8 kB
Tags Source
SHA-256 checksum
How to use checksums
90f60e1ba8a14ead1d18f21d5d51c609bac4b2bdba86b852445b53decb0542e1
BLAKE2b-256 checksum
How to use checksums
bde27b24f78b29e6fb7d0f611f9be8cd62b49c46f545487126af7588d838033f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.8.1 pkginfo/1.4.1 requests/2.10.0 setuptools/25.1.1 requests-toolbelt/0.7.1 clint/0.5.1 CPython/2.7.10 Darwin/17.7.0

Release files / httsleep-0.3.1-py2.py3-none-any.whl

Download URL httsleep-0.3.1-py2.py3-none-any.whl
Size 6.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
83ba1e71a433dd473afd8276cf72bc2edb612b71dfdfb3ec66e6cd7ab40ed2bd
BLAKE2b-256 checksum
How to use checksums
b12a987a71e1034ec25405cc01ca689d9ef859179d37eabe8a2e4c0950978ec2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.8.1 pkginfo/1.4.1 requests/2.10.0 setuptools/25.1.1 requests-toolbelt/0.7.1 clint/0.5.1 CPython/2.7.10 Darwin/17.7.0

Security for httsleep 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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