Simple Slack client library
Project description
slackpy is Slack client library for specific logging.
Install
pip install slackpy
Dependencies
requests
Sample Code
import slackpy
SUB_DOMAIN = 'your_sub_domain' # if your domain is test.slack.com, input 'test'.
AUTH_TOKEN = 'your_web_hook_token'
CHANNEL = '#general'
USER_NAME = 'Logger'
# Create a new instance.
logging = slackpy.SlackLogger(SUB_DOMAIN, 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 |
Color |
|---|---|---|
info() |
INFO (1) |
good (green) |
warn() |
WARNING (2) |
warning (orange) |
error() |
ERROR (3) |
danger (red) |
Command line
export SLACK_SUB_DOMAIN=your_sub_domain # if your domain is test.slack.com, input 'test'.
export SLACK_WEB_HOOK_TOKEN=your_web_hook_token
# LogLevel: INFO
slackpy -c '#your_channel' -m 'INFO Message' -l 1
# LogLevel: WARN
slackpy -c '#your_channel' -m 'WARN Message' -l 2
# LogLevel: ERROR
slackpy -c '#your_channel' -m 'ERROR Message' -l 3
# LogLevel: INFO (with Message Title)
slackpy -c '#your_channel' -t 'Message Title' -m 'INFO Message' -l 1
Project details
Release history Release notifications | RSS feed
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.1.2.tar.gz
(3.0 kB
view details)
File details
Details for the file slackpy-0.1.2.tar.gz.
File metadata
- Download URL: slackpy-0.1.2.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93b6cae4da75844b0c563286e2eae5001347585bb8e03e5e501bc56b8f42c1e5
|
|
| MD5 |
a85b094ca68f8ec3b11f640d4fb1297a
|
|
| BLAKE2b-256 |
b9c98671a7385039561dc15ebf049a87138ed22088641c1e6abffe6ea36f663f
|