Package: slack-time
SlackTimeBackgroundThis library is a wrapper around the Slack WebAPI (https://api.slack.com/methods)This library uses the beautiful requests library (https://github.com/psf/requests) and the methods returnrequests.ResponseobjectsThis library is a homage to the great (and now archived) Slacker (https://github.com/os/slacker)This library is a response to the official Slack client (https://github.com/slackapi/python-slackclient). I'm so petty I couldn't stand the the camel/snake-case hybrid:client.chat_postMessageThis library was made mostly by a script that scraped the Slack API method page and automagically generated the codeThis library was touched up by a human and some tests and docs generated, but I am fully aware there could be bugsAimThis library aims to be:SimpleIntuitiveFastInstallThis library uses f-strings and therefore is 3.6+Simply install using pippip install slack_timeLearn by exampleGetting a client:from slack_time import get_slack_time

slack_time = get_slack_time()get_slack_timewill grab theSLACK_API_TOKENenvironment variableEnvironment variable grabbed can be changed:slack_time = get_slack_time('SLACK_TOKEN')Making a client:from slack_time import SlackTime

slack_time = SlackTime('xoxo-hello-world')Or with other config:from slack_time import SlackTime
import requests

token = "xoxo-gossip-girl"
session = requests.Session()
proxies = {"http": "10.10.10.10:80", "https": "10.11.12.13:8080"}
timeout = 60

slack_time = SlackTime(token, session=session, proxies=proxies, timeout=timeout)Using the client:from slack_time import get_slack_time

slack_time = get_slack_time()

slack.chat.post_message("general", "Hey team, I love this knock off Slacker library!")Inspecting a response:>>> resp = slack_time.api.test(foo='bar')
>>> resp
<Response [200]>
>>> resp.json()
{
    'ok': True,
    'args': {
        'token': 'xoxp-your-token',
        'foo': 'bar'
    }
}Errors:When an 'error' is returned in the response it will be raised as an exceptionThe exception will subclassed fromSlackError>>> slack_time.api.test(error='hello')
Traceback (most recent call last):
  ...
slack_time.api.hello: You tried to perform a request to https://slack.com/api/api.test.
The server returned a 'hello' response. Find out more at: https://api.slack.com/methods/api.test#errors

>>> from slack_time import SlackError
>>> try:
...     slack_time.api.test(error='hello')
... except SlackError:
...     passHow it worksIn the web API docs (https://api.slack.com/methods) the methods are listed as endpoints e.g. admin.apps.requests.listThe url for admin.apps.requests.list would behttps://slack.com/api/admin.apps.requests.listThe client method would beslack_time.admin.apps.requests.list(*args, **kwargs)The method translation would be from camelCase to snake_caseSome examples:admin.conversations.convertToPrivate -> slack_time.admin.conversations.convert_to_privateadmin.conversations.ekm.listOriginalConnectedChannelInfo -> admin.conversations.ekm.list_original_connected_channel_infofiles.revokePublicURL -> files.revoke_public_urletcExamplesfrom slack_time import get_slack_time

slack = get_slack_time()

slack.files.upload('hello_world.txt')

with open('hello_world.txt') as f:
    slack.files.upload(f)DocsPlease use the slack docshttps://api.slack.com/methodsContributingI imagine there are bugsPlease feel free to submit a PR, you will need to install pre-commit (https://pre-commit.com/)