ntfy_wrapper.cli

py-ntfy command-line interface.

Module Contents

Functions

add_base_url(url[, conf_path])

Adds an url to the config file to override the default https://ntfy.sh.

add_default(key, value[, conf_path])

Adds a default to the config file.

add_email(email[, conf_path])

Adds an email to the config file.

add_topic(topic[, conf_path])

Adds a topic to the config file.

clean([conf_path, force])

Removes the configuration file.

describe([conf_path])

Describes the ntfy-wrapper configuration: topics, targets and defaults.

init([conf_path, force])

Initializes the configuration file. It should NOT be tracked by version

new_topic([save])

Generates a random topic name and saves it to the config file if

remove_base_url(url[, conf_path])

Removes an url from the config file.

remove_default(key[, conf_path])

Removes a default from the config file.

remove_email(email[, conf_path])

Removes an email from the config file.

remove_topic(topic[, conf_path])

Removes a topic from the config file.

send(message[, conf_path, emails, topics, title, ...])

Sends a notification to the given emails and topics. Optional command-line arguments

Attributes

add_app

app

remove_app

ntfy_wrapper.cli.add_app
ntfy_wrapper.cli.add_base_url(url, conf_path=None)

Adds an url to the config file to override the default https://ntfy.sh. If –conf-path is not given, the current working directory will be used.

Parameters
  • url (str) –

  • conf_path (Optional[str]) –

ntfy_wrapper.cli.add_default(key, value, conf_path=None)

Adds a default to the config file. If –conf-path is not given, the current working directory will be used.

Parameters
  • key (str) –

  • value (str) –

  • conf_path (Optional[str]) –

ntfy_wrapper.cli.add_email(email, conf_path=None)

Adds an email to the config file. If –conf-path is not given, the current working directory will be used.

Parameters
  • email (str) –

  • conf_path (Optional[str]) –

ntfy_wrapper.cli.add_topic(topic, conf_path=None)

Adds a topic to the config file. If –conf-path is not given, the current working directory will be used.

Parameters
  • topic (str) –

  • conf_path (Optional[str]) –

ntfy_wrapper.cli.app
ntfy_wrapper.cli.clean(conf_path=None, force=False)

Removes the configuration file. Use –conf-path to specify a path to the configuration file. Use –force to skip the confirmation prompt.

Parameters
  • conf_path (Optional[str]) –

  • force (bool) –

ntfy_wrapper.cli.describe(conf_path=None)

Describes the ntfy-wrapper configuration: topics, targets and defaults.

Parameters

conf_path (Optional[str]) –

ntfy_wrapper.cli.init(conf_path=None, force=False)

Initializes the configuration file. It should NOT be tracked by version control in order to protect the topic ID. Use –conf-path to specify a path to the configuration file. Use –force to overwrite an existing configuration file.

Parameters
  • conf_path (Optional[str]) –

  • force (bool) –

ntfy_wrapper.cli.new_topic(save=False)

Generates a random topic name and saves it to the config file if you use the –save option.

Parameters

save (Optional[bool]) –

ntfy_wrapper.cli.remove_app
ntfy_wrapper.cli.remove_base_url(url, conf_path=None)

Removes an url from the config file. If –conf-path is not given, the current working directory will be used.

Parameters
  • url (str) –

  • conf_path (Optional[str]) –

ntfy_wrapper.cli.remove_default(key, conf_path=None)

Removes a default from the config file. If –conf-path is not given, the current working directory will be used.

Parameters
  • key (str) –

  • conf_path (Optional[str]) –

ntfy_wrapper.cli.remove_email(email, conf_path=None)

Removes an email from the config file. If –conf-path is not given, the current working directory will be used.

Parameters
  • email (str) –

  • conf_path (Optional[str]) –

ntfy_wrapper.cli.remove_topic(topic, conf_path=None)

Removes a topic from the config file. If –conf-path is not given, the current working directory will be used.

Parameters
  • topic (str) –

  • conf_path (Optional[str]) –

ntfy_wrapper.cli.send(message, conf_path=None, emails=None, topics=None, title=None, priority=None, tags=None, click=None, attach=None, actions=None, icon=None)

Sends a notification to the given emails and topics. Optional command-line arguments can be passed to override the defaults in the config file and customize the message options. Refer to https://ntfy.sh/docs/publish to understand the options. Run py-ntfy send –help to see the available options.

Parameters
  • message (str) – The message to send

  • conf_path (Optional[str], optional) – Where to load the configuration from. Defaults to None which means $CWD/.ntfy.conf.

  • emails (Optional[str], optional) – Single email or comma-separated list of emails to dispatch the notification to. Defaults to None.

  • topics (Optional[str], optional) – Single topic or comma-separated list of topics to dispatch the notification to. Defaults to None.

  • title (Optional[str], optional) – The notification’s title. Defaults to None.

  • priority (Optional[int], optional) – The notification’s priority. Defaults to None.

  • tags (Optional[str], optional) – The notification’s tags. Defaults to None.

  • click (Optional[str], optional) – The notification’s click option (url for instance). Defaults to None.

  • attach (Optional[str], optional) – The notification’s attachment. Defaults to None.

  • actions (Optional[str], optional) – The notification’s actions as per https://ntfy.sh/docs/publish/#using-a-header. Defaults to None.

  • icon (Optional[str], optional) – _description_. Defaults to None.