A full featured python Slack API SDK
Project description
Slackly - A Slack Toolkit
Use Cases:
Use the slackly.SlackClient to make calls to the Web API
Use the slackly.SlackRTMClient to listen to the Real Time Messaging API (via a websocket connection)
Use the slackly.events and slackly.schema.types in this library to build higher level abstractions on the Slack API
Installing
$ pip install slackly
Simple Examples
Creating a Client and Making an API Call
from slackly import SlackClient import os client = SlackClient(token=os.environ['SLACK_TOKEN']) # Call the api.test endpoint client.api_call('api.test')
Creating the API object and preparing a call
from slackly import SlackAPI, SlackClient import os slack = SlackAPI() # Prepare an api call. Pass "api_call" a client to get actually make the call api_call = slack.api.test() client = SlackClient(token=os.environ['SLACK_TOKEN']) result = api_call(client)
Printing Events off of the Real Time Messaging API
import os from slackly import SlackRTMClient rtm_client = SlackRTMClient.from_token(token=os.environ['SLACK_TOKEN']) for event in rtm_client.get_events_forever(): print(event)
Using Event Types
import os from slackly import SlackRTMClient, SlackEventParsed from slackly.events import Message, UserTyping rtm_client = SlackRTMClient.from_token(token=os.environ['SLACK_TOKEN']) rtm_client.event_factory = SlackEventParsed # Tell the RTM client to make events using this class for event in rtm_client.get_events_forever(): if isinstance(event, Message): print("We're dealing with a message") elif isinstance(event, UserTyping): print("Someone's typing") else: print("I don't care about this event")
Development
$ git clone https://github.com/huntcsg/slackly.git $ cd slackly $ tox # Runs test suites against all python versions, pypy, does style and test coverage analysis
All pull requests must pass the travis-ci builds
All pull requests should include inline (docstring) documentation, updates to built documentation if applicable, and test coverage. This project aspires to be a 100% test coverage library.
If integration or regression test coverage is needed, let the project maintainer know and we can work out the best way to do so.
Changes
1.0.4
Documentation Updates and Release stability
1.0.0
Initial Release
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
Built Distribution
Hashes for slackly-1.0.7-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6694c063b09381b7cc2fa8e31fcc89a2edf6ab2bc015d82905b0e9d1d199cc7f |
|
MD5 | 59dfbde53e3b24fc04de25639dcd2298 |
|
BLAKE2b-256 | 61b823a404e8974f7bfdec75ca037bec1f0427a85451750b20337f96d39dfba2 |