Layabout
⚠️ Layabout is deprecated. There will be no further support. ⚠️
Layabout is a small event handling library on top of the Slack RTM API.
from pprint import pprint
from layabout import Layabout
app = Layabout()
@app.handle('*')
def debug(slack, event):
""" Pretty print every event seen by the app. """
pprint(event)
@app.handle('message')
def echo(slack, event):
""" Echo all messages seen by the app except our own. """
if event.get('subtype') != 'bot_message':
slack.rtm_send_message(event['channel'], event['text'])
def someone_leaves(events):
""" Return False if a member leaves, otherwise True. """
return not any(e.get('type') == 'member_left_channel'
for e in events)
if __name__ == '__main__':
# Automatically load app token from $LAYABOUT_TOKEN and run!
app.run(until=someone_leaves)
print("Looks like someone left a channel!")
Installation
To install Layabout use pip and PyPI:
pip install layabout
What’s It Good For?
You can think of Layabout as a micro framework for building Slack bots. Since it wraps Slack’s RTM API it does best with tasks like interacting with users, responding to channel messages, and monitoring events. If you want more ideas on what you can do with it check out the examples.
Features
Not sold yet? Here’s a list of features to sweeten the deal.
Automatically load Slack API tokens from environment variables, provide them directly, or even bring your own SlackClient.
Register multiple event handlers for one event.
Register a single handler for multiple events by stacking decorators.
Configurable application shutdown.
Configurable retry logic in the event of lost connections.
Lightweight. Depends only on the official Python slackclient library.
Code of Conduct
Everyone interacting with the Layabout project’s codebase is expected to follow the Code of Conduct.
Metadata
Release files for layabout 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| layabout-1.0.2.tar.gz | 7.7 kB | Without provenance | Details for layabout-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| layabout-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for layabout-1.0.2-py3-none-any.whl |
Total release size: 15.6 kB
Release files / layabout-1.0.2.tar.gz
| Download URL | layabout-1.0.2.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a09cfe73b556373600a6c7fad10bb7630571d480cadce42aa01113345bc61a70
|
|
BLAKE2b-256 checksum How to use checksums |
eeef8bd32bcec94ae4b8032f218868f49b5a9780173426d2a105d4ed9dee08b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.20.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.5
|
Release files / layabout-1.0.2-py3-none-any.whl
| Download URL | layabout-1.0.2-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
92f59566b376620f43c83748184708a83449aeb9a054ad672c4a57cb1ccd9f9c
|
|
BLAKE2b-256 checksum How to use checksums |
083b720d775ef975321a9a31599cfc897d88c7866e2b986b219be61cadec72a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.20.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.5
|
Security for layabout 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.