• Stars
    star
    148
  • Rank 249,983 (Top 5 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 11 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Python wrapper for Slack's API

pyslack

ghit.me

A Python wrapper for Slack's API

https://api.slack.com

(Formerly) listed as an official python client on Slack's Community-built Integrations page

Installation

pip install pyslack-real

(some chump stole the pyslack name right out from under me!)

Usage

Post a message into your Slack integration's #play channel

>>> from pyslack import SlackClient
>>> client = SlackClient('YOUR-TOKEN-HERE')
>>> client.chat_post_message('#play', "testing, testing...", username='slackbot')
{u'ok': 1, u'timestamp': u'1392000237000006'}

Integrate a SlackHandler into your logging!

>>> import logging
>>> from pyslack import SlackHandler

>>> logger = logging.getLogger('test')
>>> logger.setLevel(logging.DEBUG)

>>> handler = SlackHandler('YOUR-TOKEN-HERE', '#channel_name', username='botname')
>>> handler.setLevel(logging.WARNING)
>>> formatter = logging.Formatter('%(asctime)s [%(levelname)s] %(name)s (%(process)d): %(message)s')
>>> handler.setFormatter(formatter)
>>> logger.addHandler(handler)

>>> logger.error("Oh noh!") # Will post the formatted message to channel #channel_name from user botname

Testing

Before running the test suite, you'll need to add the required libraries to your environment. These aren't included in the main requirements.txt because they are not needed for normal operation of pyslack.

pip install -r tests/requirements.txt

The tests can be run as follows:

$ python setup.py test

More Repositories

1

musicg

Automatically exported from code.google.com/p/musicg
Java
69
star
2

stravalib-scraper

Library for scraping Strava data
Python
36
star
3

the-masters-api

The Masters API!
Shell
10
star
4

csv-position-reader

A custom CSV reader implementation with direct file access
Python
9
star
5

strava-authenticator-android

Strava Authenticator for Android: A shell for building Android apps with Strava authentication
Java
8
star
6

ghost-detector

Use the deviation in your phone's signal strength for detecting ghosts - use with care!
Java
8
star
7

django-tesseract

A Django web interface for interacting with Tesseract-OCR
JavaScript
7
star
8

tilt

Android example: Use sensors to detect tilt and apply it as an input
Java
7
star
9

lirc-python

Python wrapper for LIRC calls, based on https://github.com/slimjim777/web-irsend
Python
3
star
10

nofi-android

NoFi - the free international offline wifi finder!
Java
3
star
11

poor-mans-money-counter

Ever wonder where you're money's going?
Java
3
star
12

github-dates-chrome-extension

A Chrome Extension to display real, helpful timestamps with Github commits like 'May 10, 2015, 1:57 AM EDT' instead of useless ones like '2 days ago'
JavaScript
3
star
13

kaggle-random-dataset-generator

Kaggle Random Dataset Generator
Python
3
star
14

mta-fare-buster-android

No more leaving change on your NYC MTA Metrocard! Android version
Java
2
star
15

fantasyfootball

Fantasy Football API
Python
2
star
16

pushsi

A command line interface for sending push notifications to your phone
Python
1
star
17

sub

Python helper library for accessing MTA subway data
Python
1
star
18

random-unicode-char

Python lib for generating a random unicode character, scraped from http://unicode.bloople.net
Python
1
star
19

zeitgeist-scraper

A collection of year-end music lists, feel free to contribute
HTML
1
star
20

yodle

Yodle puzzles and my solutions (from 2011)
1
star
21

topcoder

A git repo for holding my Top Coder code
Java
1
star
22

bhatti-type

Library for converting regular text into Bhatti Type!
HTML
1
star
23

sam-video

Attempt at building an video recorder for Android
Java
1
star
24

django-redis-shell

./manage.py redisshell
Python
1
star