Skip to main content

Post a payload to specfied url

Project description

ops-py-message-handler


Description

Post a message to a url (webhook).

Note: In the example code below a Slack Automation Workflow has already been built. The message part of the Slack Workflow has been defined to receive a Title and a Text variable.


Installation

pip install ops-py-message-handler


Usage

Export your slack webhook:
export WEBHOOK="12345blablabla...."

Example code:

from message_handler import message_handler as mh

WEBHOOK = os.getenv("WEBHOOK")
heading = "This is the heading"
message = "This is the message"
mh = MessageHandler(WEBHOOK)
mh.set_payload(Title=heading, Text=message)
mh.post_payload()
response_code = mh.get_response_code()
print(response_code)

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

ops-py-message-handler-0.0.1.tar.gz (3.6 kB view hashes)

Uploaded Source

Built Distribution

ops_py_message_handler-0.0.1-py3-none-any.whl (3.8 kB view hashes)

Uploaded Python 3

Supported by

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