Skip to main content

Logging to Slack, made easy.

Project description

SlackPush - Logging to Slack made easy

SlackPush provides a wrapper on requests to push messages, logs, exceptions and attachments to slack. It also supports basic formating: Bold and Perforated.

Installation

To get started, clone the repository and run

pip install slackpush

Usage

  1. Import the SlackPush object.

from slackpush import SlackPush

  1. Initialise SlackPush object with a webhook_url and channel to be posted in. To know more about incoming webhooks read here.

slackpush = SlackPush(webhook_url= <your webhook_url>, channel=<your channel>)

  1. Push messages/ logs using send_message method.

slackpush.send_message('It is up and running')

  1. Similarly you can push specific exceptions as alerts to slack using send_exception method. This pushes the whole stack trace of the error to slack.
try:
    < your code here>
except Exception as e:
    slackpush.send_exception(e)
  1. To send attachments to slack, you need to pass Slack OAuth token. More details can be found here.

Note: See that the token has relevant persmissions to post the attachement

To add token to the object use add_token method. To send an attachment to Slack:

slackpush.send_attachment(<path to attachment>)

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

slackpush-0.1.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

slackpush-0.1.1-py2.py3-none-any.whl (4.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file slackpush-0.1.1.tar.gz.

File metadata

  • Download URL: slackpush-0.1.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.4

File hashes

Hashes for slackpush-0.1.1.tar.gz
Algorithm Hash digest
SHA256 67920c41c3ded846c6c3a2b1008a5d3059f4079ae3626f40e8f611b85d185458
MD5 60b8421638fb3349cd2e8dc03806d763
BLAKE2b-256 e449cace3812e9600619301586400feabbba3f8225eff670755c48051050f8b7

See more details on using hashes here.

File details

Details for the file slackpush-0.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: slackpush-0.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.4

File hashes

Hashes for slackpush-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2d5c183ace2483403b71eb687ea74ca2b92a337c25fdedec2808dc950fe382eb
MD5 452065a891c37dd9f7380de28941ce98
BLAKE2b-256 a158701e24a351731df0ed6d69c0bdd1bc5a7ec67f9465be59f68dc7c63dbcf2

See more details on using hashes here.

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