slackperson
A simple class (SlackPerson) for retrieving and storing information about a person in your slack channel from the slack api.
Installation
$ pip install slackperson
You will also need the slackclient package.
Usage
The SlackPerson class can be initialized with the from_userlist method that allows you to supply a username or userid and the output of the users.list method to get data about a user.
After initialization, an instance of SlackPerson will have these attributes:
username: the username supplied at instantiation (if username was supplied with preceeding ‘@’, it will be stripped off.)
userid: the internal id of the user (this is useful for tagging in api generated messages.
email: the user’s account email address in slack
fname: the user’s first name
lname: the user’s last name
team: the user’s team id
Import and use the SlackPerson class:
from slackperson import SlackPerson
from slackclient import SlackClient
sc = SlackClient(os.environ['SLACK_API_TOKEN'])
userlist = sc.api_call('users.list')
me = SlackPerson.from_userlist('myusername', userlist)
If myusername is a member of your channel (i.e. on the userlist), the object me will now have all of the SlackPerson attributes. If not, it will raise SlackDataError. It will also raise SlackDataError if the userlist is malformed in any way.
Tests
There is a test case for a successful creation of a SlackPerson object and for the cases where exceptions should be raised. They are unittests so they can be run with unittest discovery or pytest.
Metadata
Release files for slackperson 0.5.1
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 |
|---|---|---|---|---|
| slackperson-0.5.1.tar.gz | 3.6 kB | Without provenance | Details for slackperson-0.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| slackperson-0.5.1-py3-none-any.whl | Python 3 | none | any | Details for slackperson-0.5.1-py3-none-any.whl |
Total release size: 10.8 kB
Release files / slackperson-0.5.1.tar.gz
| Download URL | slackperson-0.5.1.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
128ed39aeb96f15ed6befffb7d07d4dab26a8c6765aa8ea89ae4ee1af2d2d2c5
|
|
BLAKE2b-256 checksum How to use checksums |
002fb5a5153faf8e23b23b67da6ff714fba2f4d62f5296b9d3c24ccf37c2cca4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/0.12.10 CPython/3.7.1 Linux/4.19.2-arch1-1-ARCH
|
Release files / slackperson-0.5.1-py3-none-any.whl
| Download URL | slackperson-0.5.1-py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
410e1780f8599cca5c7370e70a988bdab0c1c2734ad3f141f86f3a121ef696c2
|
|
BLAKE2b-256 checksum How to use checksums |
591c7227c7dbdb9e84ed56339098446e12dd3965599a618b5e8294aa5c30216a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/0.12.10 CPython/3.7.1 Linux/4.19.2-arch1-1-ARCH
|
Security for slackperson 0.5.1
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.