Skip to main content

headnode notifier

Simple script for sending emails.

Usage examples

usage: headnode_notifier [address] [OPTION]

Simple script for email notifications. Uses gmail by default.

positional arguments:
                    Recipient address

optional arguments:
  -h, --help        show this help message and exit
  -v, --version     show program's version number and exit
  --subject         Message subject
  --body            Message body
  --attach          Attachment
  --serv-addr       Server address. Default <smtp.gmail.com>
  --port            Server's port. Default: <587>
  --from-addr       Account address.
  --password-file   Read password from exeternal file. Prevents hard-coding
                    password anywhere in this script. IMPORTANT! Password is
                    stored as plain text! Do NOT use with your personal
                    account!

Let's assume you are using default account and you have password file in a proper place

You can specify the message subject, content and attach a file.

headnode_notifier.py recipient@domain.com --subject 'Important message' --body 'Hello there!' --attach ./some/file.zip

You can also send just blank message, only recipient@domain.com is truly obligatory if using default values for the rest.

You can specify server, port and else if you wish with --serv-addr smpt.provider.com --port 42 --from-addr my.address@provider.com

Config handling

If an option is not specified in the CLI, it is read from the headnode_notifier.config file. It is meant to facilitate the usage by setting default values for:

  1. Server address.
  2. Port.
  3. Mailbox address
  4. /path/to/password_file
  • Config content:
[server]
address = smtp.gmail.com
port = 587

[mailbox]
address =
password_file =
  • Config location: $HOME

  • Config name:

.headnode_notifier.config

Password handling

In order to avoid storing the password anywhere in the script, it is read from file. You can specify the path using --password-file /path/to/file or in the config file. Remember that the password file is plain text so use the script with caution.

Using gmail

Remember to allow less secure apps to connect if using gmail. You can set it on google account security page

Metadata

Release files for headnode-notifier 1.5.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 headnode-notifier 1.5.4
File Size Uploaded
headnode_notifier-1.5.4.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for headnode-notifier 1.5.4
File Interpreter ABI Platform
headnode_notifier-1.5.4-py3-none-any.whl Python 3 none any Details

Total release size: 10.9 kB

Release files / headnode_notifier-1.5.4.tar.gz

Download URL headnode_notifier-1.5.4.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
75b8de4d65dc4d3b9abf024a866f4f1345d03c9219523184782718f68ddb2f78
BLAKE2b-256 checksum
How to use checksums
db89a75567db61ca18d0d2ef15606a72b7239fadbf81c5b70176e00d5f7b123d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.3

Release files / headnode_notifier-1.5.4-py3-none-any.whl

Download URL headnode_notifier-1.5.4-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea4f3b927e00602f6d1db57dc95a78d2e702af9a5d643ecff56108bc50035d4e
BLAKE2b-256 checksum
How to use checksums
1bafc31b77303b3bf5988f42dd90de2d12eaba539954748bdacd1aceac5e0741
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.3

Release history Release notifications | RSS feed

This release

1.5.4 This release

2 release files

1.5.3

2 release files

1.5.2

1 release file

1.5.1

2 release files

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