Skip to main content

Tool to send notifications

Project description

ppnotify

Tool to send notifications

PyPI package: ppnotify

Feel free to open a GitHub issue if you spot a problem or have an improvement idea. I will be happy to look into it for you.

Installation

The package is available in PyPI and can be installed using pip:

$ pip install --user ppnotify
$ ppnotify --help

Once installed, a command line tool ppnotify will be available in your system's PATH.

Configuration

By default, the tool reads its configuration from ~/.config/ppnotify file (the location can be overridden by setting environment variable XDG_CONFIG_HOME).

The config file should look like this:

[default]
slack_key = xxx
email_domain = example.com

[teams]
webhook_url = https://url.example.com
channel1 = team_id1,channel_id1
channel2 = https://dedicated-webhook-url.example.com

For Teams channels, the value can be either a team_id,channel_id pair (which uses the default webhook_url) or a dedicated https:// webhook URL used directly for that channel.

Usage - Help

$ ppnotify --help
usage: ppnotify [--version] [--help] [--debug] [--verbose] [-m {slack,teams}] [-f SENDER] -t RECIPIENTS [RECIPIENTS ...] [-s SUBJECT] [-H]

Tool to send notifications

options:
  --version             show program's version number and exit
  --help                show this help message and exit
  --debug               debugging mode
  --verbose             verbose debugging mode
  -m, --method {slack,teams}
                        notification method (default: teams)
  -f, --from SENDER     sender
  -t, --to RECIPIENTS [RECIPIENTS ...]
                        recipient
  -s, --subject SUBJECT
                        subject
  -H, --code            send code block

Usage - CLI

Send a Teams message (default method):

$ echo 'The king is dead, long live the king!' \
  | ppnotify -Hf 'Jon Snow' \
  -t 'game-of-thrones-channel' \
  -s 'Re: secret message'

Send a Slack message:

$ echo 'The king is dead, long live the king!' \
  | ppnotify -m slack -Hf 'Jon Snow' \
  -t 'game-of-thrones-channel' \
  -s 'Re: secret message'

Usage - Python module

Send a Teams message:

from ppnotify import Teams

teams = Teams('game-of-thrones-channel')

status = teams.send(
    sender='Jon Snow',
    subject='Re: secret message',
    message='The king is dead, long live the king!',
    code=True
)

Send a Slack message:

from ppnotify import Slack

slack = Slack()

status = slack.send(
    sender='Jon Snow',
    recipients=['game-of-thrones-channel'],
    subject='Re: secret message',
    message='The king is dead, long live the king!',
    code=True
)

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

ppnotify-0.4.0.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

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

ppnotify-0.4.0-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file ppnotify-0.4.0.tar.gz.

File metadata

  • Download URL: ppnotify-0.4.0.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ppnotify-0.4.0.tar.gz
Algorithm Hash digest
SHA256 bb7c2953f744f00de7c1ed1c7b2cd31e346af175b86cb2fe47e4a5aa023d1f7c
MD5 e711760e6289d4b5423386b3dbcb8948
BLAKE2b-256 a14bfa87afbded18f217e340a22a69a79d9cb2869e93555dd218604bc35429e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for ppnotify-0.4.0.tar.gz:

Publisher: main.yml on peterpakos/ppnotify

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ppnotify-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: ppnotify-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ppnotify-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f0147959a638fe4d8f3a78b3566fef38c3275fe488a5557603a6708a34fcd15c
MD5 74effea6a627029248bd48cd97157c02
BLAKE2b-256 f04972339094fad550b0fc4f6ffda5b34f8fd5f80ab37c966e577079b7ada37b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ppnotify-0.4.0-py3-none-any.whl:

Publisher: main.yml on peterpakos/ppnotify

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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