Skip to main content

Simple Slack client library

Project description

slackpy is Slack client library for specific logging.

Install

pip install slackpy

Dependencies

  • requests

Sample Code

import slackpy

AUTH_TOKEN = 'hogehoge'
ROOM_ID = 10000
USER_NAME = 'Logger'

# Create a new instance.
logging = slackpy.SlackLogger(AUTH_TOKEN, CHANNEL, USER_NAME)

# LogLevel: INFO
logging.info(message='INFO Message')

# LogLevel: WARN
logging.warn(message='WARN Message')

# LogLevel: ERROR
logging.error(message='ERROR Message')

Correspondence table

Method

LogLevel

Notify

Color

info()

INFO (1)

False

green

warn()

WARNING (2)

True

yellow

error()

ERROR (3)

True

red

Command line

export SLACK_TOKEN=your_api_token

# LogLevel: INFO
slackpy 10000 -m 'INFO Message' -l 1

# LogLevel: WARN
slackpy -r 10000 -m 'WARN Message' -l 2

# LogLevel: ERROR
slackpy -r 10000 -m 'ERROR Message' -l 3

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

slackpy-0.0.2.tar.gz (2.9 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page