Skip to main content

Simple sd_notify client library for Python 3

Project description

sd_notify

Simple sd_notify(3) client functionality implemented in Python 3.

Usage:

import sd_notify

notify = sd_notify.Notifier()
if not notify.enabled():
    # Then it's probably not running is systemd with watchdog enabled
    raise Exception("Watchdog not enabled")

# Report a status message
notify.status("Initialising my service...")
time.sleep(3)

# Report that the program init is complete
notify.ready()
notify.status("Waiting for web requests...")
time.sleep(3)

# Report an error to the service manager
notify.notify_error("An irrecoverable error occured!")
# The service manager will probably kill the program here
time.sleep(3)

Author: stig@stigok.com Dec 2019

Reference

<class 'sd_notify.Notifier'>

_send(msg)

Send string msg as bytes on the notification socket

enabled()

Return a boolean stating whether watchdog is enabled

notify()

Report a healthy service state

notify_error(msg=None)

Report a watchdog error. This program will likely be killed by the service manager.

If msg is not None, it will be reported as an error message to the service manager.

ready()

Report ready service state, i.e. completed initialisation

status(msg)

Set a service status message

Project details


Download files

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

Source Distribution

sd-notify-0.1.0.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sd_notify-0.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file sd-notify-0.1.0.tar.gz.

File metadata

  • Download URL: sd-notify-0.1.0.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.8.1

File hashes

Hashes for sd-notify-0.1.0.tar.gz
Algorithm Hash digest
SHA256 74b343f5604ea3287a9d6812657e23c5bf3ccf67a771f528f049296fc2286948
MD5 c0c6920c2677223741e2f10009c69fcf
BLAKE2b-256 8fc4486fbcc18a768e9b4de682dab28f2d654e9fa9ad902fdc45221275996120

See more details on using hashes here.

File details

Details for the file sd_notify-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sd_notify-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.8.1

File hashes

Hashes for sd_notify-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a3ab485d6a1a07035a3caed00b9efc1953b08c268b50100beface5b2c6fd84b
MD5 f98314170a2d4292970d06cde91c0adc
BLAKE2b-256 68abcfa2ce75ac78617c98157bae65c56a7f5bd6772ff5a096e352afbe90e804

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page