Skip to main content

Basic functions for sending notifications via HipChat API (v2)

Project description

https://travis-ci.org/yunojuno/hipchat-notifications.svg?branch=master https://badge.fury.io/py/hipchat-notifications.svg

HipChat Notifications

This is a very simple library for sending user and room notifications to HipChat via their v2 API.

It contains a couple of generic functions for sending messages to rooms and users within HipChat.

>>> hipchat.notify_room('Customer Service', 'This is a message')
>>> hipchat.notify_user('hugo', 'Hello, Hugo')

It includes some colour-specific helpers for room-only notifications:

>>> hipchat.green('Customer service', 'This is a green message')

The functions support the message_format values:

html - Message is rendered as HTML and receives no special treatment. Must be valid HTML and entities must be escaped (e.g.: ‘&’ instead of ‘&’). May contain basic tags: a, b, i, strong, em, br, img, pre, code, lists, tables.

text - Message is treated just like a message sent by a user. Can include @mentions, emoticons, pastes, and auto-detected URLs (Twitter, YouTube, images, etc).

>>> hipchat.green('Customer service', 'Hello @fred', message_format='text')

The color, notify and from parameters are also supported (from is passed as a kwarg called label):

>>> notify_room(
...     'customer service',
...     'Hey there @Tony',
...     color='red',
...     label='baz',
...     notify=True,
...     message_format='text'
... )

Settings

The following settings are read from the environment using os.getenv

  • HIPCHAT_API_TOKEN

A valid API access token. See the API docs for details on how to generate a token. (Hint: the easiest way is to use a “Personal access token” generated through the site.)

If there is no token set in the environment the notifications will be logged using the ‘hipchat’ logger, with a DEBUG level.

Installation

The library is available on PyPI as ‘hipchat_notifications’.

Tests

The tests can be run using tox:

$ tox

Contributors

  • Hugo Rodger-Brown - @hugorodgerbrown

  • Roberto Salgado - @droberin

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

hipchat-notifications-0.4.1.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

hipchat_notifications-0.4.1-py2-none-any.whl (10.5 kB view details)

Uploaded Python 2

File details

Details for the file hipchat-notifications-0.4.1.tar.gz.

File metadata

File hashes

Hashes for hipchat-notifications-0.4.1.tar.gz
Algorithm Hash digest
SHA256 0d42bf1acd1b73d42b01a88a01199105406b2f61e1f23b60a387a4450ac35a39
MD5 ad8bf262cfd3b4284dac7e251e99b84f
BLAKE2b-256 bf8fb06cc4da53f49296fa343edbb451a26dca7c01bd4e8bcc90c786b0e332dc

See more details on using hashes here.

File details

Details for the file hipchat_notifications-0.4.1-py2-none-any.whl.

File metadata

File hashes

Hashes for hipchat_notifications-0.4.1-py2-none-any.whl
Algorithm Hash digest
SHA256 2ebfb19e05b6e7205a54ff8585d954b497041add1dd66dc061e7378c0040932f
MD5 884bf71b9abefe3976d2b3027df708fe
BLAKE2b-256 dc9f35237ea477e849159ce428519094224d5c1e4e3cc907b682b7ebebe06629

See more details on using hashes here.

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