Python (a)sync Slack API library
Slack-sansio is available on PyPI.
$ pip3 install slack-sansio # No specific implementation requirements
$ pip3 install slack-sansio[requests] # Requests implementation requirements $ pip3 install slack-sansio[aiohttp] # Aiohttp implementation requirements $ pip3 install slack-sansio[curio] # Curio implementation requirements $ pip3 install slack-sansio[trio] # Trio implementation requirements
import slack
import pprint
import requests
from slack.io.sync import SlackAPI
session = requests.session()
client = SlackAPI(token=TOKEN, session=session)
data = client.query(slack.methods.AUTH_TEST)
pprint.pprint(data)
For more examples see the examples folder.
Most people would want to use one of these implementations directly. For those that have an HTTP library which is not supported this library provide the base tools to ease the use of the Slack API.
- Synchronous with request.
- Asyncio with aiohttp.
- Curio with asks (In development).
- Trio with asks (In development).
The library also provide an abstract base class on which to built I/O implementation.
- Rework pytest plugin
- Add support for block-type slack actions
- Migrate to poetry for dependencies management
- Remove treq implementation.
- Fix Documentation build.
- Rework of the pytest plugin
slack.tests.plugins
. - Remove deprecated rate limit code.
- Add type annotations & fix found bugs.
- Move
slack.exceptions.UnknownActionType
toslack.action.UnknownActionType
.
- Allow testing without installing sync I/O requirements
- Support for new slack request signing (
sansio.validate_request_signature
andexceptions.InvalidSlackSignature
)
- Support incoming action of type
message_action
- Support incoming action of type
dialog_submission
.
- Support sending json for selected slack methods.
- Add
subtype
argument toevents.MessageRouter.register
. - Fix routing bug for message with
text=None
.
- Refactor tests
- Create pytest plugin with useful fixtures.
- Add
minimum_time
argument toSlackAPI.iter
in order to force a minimum elapsed time between two call to the API
- Add conversation & dialog methods in Enum.
- Fix
not_authed
when using rate limit retry.
- Bugfix for
actions.Action
andactions.Router
. - Bugfix in data serialization for response urls
https://hooks.slack.com/
.
- Bugfix for
commands.Router
. - New
events.MessageRouter
forevents.Message
routing based on regular expression. - Rename
events.Router
toevents.EventRouter
. - Change
TypeError
toValueError
inevents.EventRouter.register
. - Bugfix for threaded messages.
- Fix routing bug in
events.Router
. - Inherit from
Exception
instead ofBaseExecption
in custom exceptions.
- Curio support (query and iterate)
- Trio support (query and iterate)
- Twisted support (query only)
- Enum of slack API methods
- Initial beta release
- RTM API
- Pagination
- Initial development release