Skip to main content

babis

https://img.shields.io/pypi/v/babis.svg https://img.shields.io/travis/glogiotatidis/babis.svg

Decorator that pings URLs before and after executing the wrapped obj. Useful to monitor cron jobs with services like Dead Man’s Snitch or HealthChecks.io.

Features

  • Pre and After run pings

  • Custom user agent

  • Silent failures

  • Rate limiting

Usage

Ping after successful execution:

@babis.decorator(ping_after='http://healthchecks.io/XXX')
def cron_job():
  pass

Some services support pre and after hooks to measure the running time:

@babis.decorator(ping_before='http://healthchecks.io/XXX', ping_after='http://healthchecks.io/XXX')
def measured_cron_job():
  pass

You can also send a POST instead of the default GET:

@babis.decorator(ping_before='http://healthchecks.io/XXX', method='post')
def cron_job_with_post():
  pass

And if you don’t care if the ping fails, silence the errors:

@babis.decorator(ping_before='http://healthchecks.io/XXX', silent_failures=True)
def cron_job_silent_failure():
  pass

You can also rate limit the number of pings send to play nice with third party services, let’s say to at most 1 call in 5 minutes:

@babis.decorator(ping_after='http://healthchecks.io/XXX', rate='1/5m')
def cron_job_rate_limited():
  pass

or at most 24 calls per day:

@babis.decorator(ping_after='http://healthchecks.io/XXX', rate='24/1d')
def cron_job_rate_limited():
  pass

Note that if you defined both ping_after and ping_before URLs then each call counts for two hits by the rate limiter.

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.2.0 (2017-05-24)

  • Add rate limiting.

0.1.0 (2016-08-23)

  • First release on PyPI.

Metadata

Release files for babis 0.2.4

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

Source distribution (sdist)

Source distribution for babis 0.2.4
File Size Uploaded Provenance Actions
babis-0.2.4.tar.gz 6.9 kB Without provenance Details for babis-0.2.4.tar.gz

Built distribution (wheel)

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

Total release size: 11.7 kB

Release files / babis-0.2.4.tar.gz

Download URL babis-0.2.4.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c33bc3c754a0bacfe09179b5c4d1a2a3b5c6ddd453cd1050251fcbf9c0bd1473
BLAKE2b-256 checksum
How to use checksums
adac511a1f808269768f127b1fc820470c2986802d55b7f7295eb1cc6fe9020a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.1.0 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/2.7.15

Release files / babis-0.2.4-py2.py3-none-any.whl

Download URL babis-0.2.4-py2.py3-none-any.whl
Size 4.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
a901e8c27a47dfe22077f60c3f2daf324909a9f3f9838ecfa4100af346703fff
BLAKE2b-256 checksum
How to use checksums
c6cb06d88b72551df352f17261b6be5843bd5e4dcf0dc9a53637429ce8b22e7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.1.0 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/2.7.15

Security for babis 0.2.4

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