ritdu-slacker


Nameritdu-slacker JSON
Version 1.5.2 PyPI version JSON
download
home_pagehttps://github.com/RingierIMU/ritdu-slacker/
SummarySimple internal Slack API wrapper
upload_time2024-05-14 15:27:54
maintainerNone
docs_urlNone
authorRingier Tech
requires_python<4.0,>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ritdu-slacker
pip installable bin to interact with the Ringier SA internal interface for slack.
Provides both CLI and Native python lib functionality.

## Motivation
- Single implementation of a wrapper around our internal slack interface.

## Installation
```bash
$ pip install ritdu-slacker
```

## Usage

### CLI
To send a message to a slack channel from within a thread:
```bash
$ ritdu-slacker message --workspace "${SLACK_WORKSPACE}" --channel "${SLACK_CHANNEL//#}" --text "Update in progress" --thread-uuid "${thread_uuid}" --thread-broadcast
```

To replace a message send a new one with the same message-uuid:
```bash
$ ritdu-slacker message --workspace "${SLACK_WORKSPACE}" --channel "${SLACK_CHANNEL//#}" --text "Update complete!" --message-uuid "${message_uuid}"
```

To send a message and file to a thread in a slack channel:
```bash
$ ritdu-slacker file --workspace "${SLACK_WORKSPACE}" --channel "${SLACK_CHANNEL//#}" --text "Oops!" --file "/tmp/errorlog.txt" --thread-uuid "${thread_uuid}"
```
To send a jsonblob to slack:
```bash
$ ritdu-slacker message --text  '{ "blocks": [ { "type": "section", "text": { "type": "mrkdwn", "text": "Hello, Assistant to the Regional Manager Dwight! *Michael Scott* wants to know where youd like to take the Paper Company investors to dinner tonight.\n\n *Please select a restaurant:*" } }, { "type": "divider" }, { "type": "section", "text": { "type": "mrkdwn", "text": "*Farmhouse aThai Cuisine*\n:star::star::star::star: 1528 reviews\n They do have some vegan options, like the roti and curry, plus they have a ton of salad stuff and noodles can be ordered without meat!! They have something for everyone here" }, "accessory": { "type": "image", "image_url": "https://s3-media3.fl.yelpcdn.com/bphoto/c7ed05m9lC2EmA3Aruue7A/o.jpg", "alt_text": "alt text for image" } }, { "type": "section", "text": { "type": "mrkdwn", "text": "*Kin Khao*\n:star::star::star::star: 1638 reviews\n The sticky rice also goes wonderfully with the caramelized pork belly, which is absolutely melt-in-your-mouth and so soft." }, "accessory": { "type": "image", "image_url": "https://s3-media2.fl.yelpcdn.com/bphoto/korel-1YjNtFtJlMTaC26A/o.jpg", "alt_text": "alt text for image" } }, { "type": "section", "text": { "type": "mrkdwn", "text": "*Ler Ros*\n:star::star::star::star: 2082 reviews\n I would really recommend the  Yum Koh Moo Yang - Spicy lime dressing and roasted quick marinated pork shoulder, basil leaves, chili & rice powder." }, "accessory": { "type": "image", "image_url": "https://s3-media2.fl.yelpcdn.com/bphoto/DawwNigKJ2ckPeDeDM7jAg/o.jpg", "alt_text": "alt text for image" } }, { "type": "divider" } ] }' --command 'SlackJson' --workspace "ringier-southafrica" --channel "pe-test"
```

### Python

```
from ritdu_slacker.api import SlackClient
client = SlackClient()
client.post_message("via python api","ringier-southafrica","#pe-alerts")
{'message_uuid': '9890b802-fac3-4e61-bbe8-b53cc17fc581', 'message_ts': '1677473299.255969', 'thread_uuid': '9890b802-fac3-4e61-bbe8-b53cc17fc581', 'thread_ts': '1677473299.255969', 'channel': 'CV3JFH08J'}
client.post_message(datajson,"ringier-southafrica","pe-test",command="SlackJson")
```

## Development

To setup your development environment:

```
$ make setup-dev
```

Running make on its own generates help documentation:

```
$ make
build                Build the package
check                Check the package
clean                Clean the package
format               Format the code
install-dev          Setup development environment
install-prod         Install production dependencies
install              Install all dependencies
lint                 Lint the code
lock                 Update dependency lockfile
publish-test         Publish to the package to the PyPI test platform
publish              Publish the package
setup-binaries       Setup binaries for development. Poetry, Twine.
test                 Test the package
vscode               Update VSCode settings
```

Please read the _Makefile_ to see what each task does.

## Deployment
To deploy a new version of the package to PyPI, you need to bump the version in the _pyproject.toml_ file and then push the tag (prefixed by v) to the repository.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/RingierIMU/ritdu-slacker/",
    "name": "ritdu-slacker",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Ringier Tech",
    "author_email": "tools@ringier.co.za",
    "download_url": "https://files.pythonhosted.org/packages/aa/e9/76489826ea81aeefdbde1dd7814a61240ec47a9e145b96632926959ac459/ritdu_slacker-1.5.2.tar.gz",
    "platform": null,
    "description": "# ritdu-slacker\npip installable bin to interact with the Ringier SA internal interface for slack.\nProvides both CLI and Native python lib functionality.\n\n## Motivation\n- Single implementation of a wrapper around our internal slack interface.\n\n## Installation\n```bash\n$ pip install ritdu-slacker\n```\n\n## Usage\n\n### CLI\nTo send a message to a slack channel from within a thread:\n```bash\n$ ritdu-slacker message --workspace \"${SLACK_WORKSPACE}\" --channel \"${SLACK_CHANNEL//#}\" --text \"Update in progress\" --thread-uuid \"${thread_uuid}\" --thread-broadcast\n```\n\nTo replace a message send a new one with the same message-uuid:\n```bash\n$ ritdu-slacker message --workspace \"${SLACK_WORKSPACE}\" --channel \"${SLACK_CHANNEL//#}\" --text \"Update complete!\" --message-uuid \"${message_uuid}\"\n```\n\nTo send a message and file to a thread in a slack channel:\n```bash\n$ ritdu-slacker file --workspace \"${SLACK_WORKSPACE}\" --channel \"${SLACK_CHANNEL//#}\" --text \"Oops!\" --file \"/tmp/errorlog.txt\" --thread-uuid \"${thread_uuid}\"\n```\nTo send a jsonblob to slack:\n```bash\n$ ritdu-slacker message --text  '{ \"blocks\": [ { \"type\": \"section\", \"text\": { \"type\": \"mrkdwn\", \"text\": \"Hello, Assistant to the Regional Manager Dwight! *Michael Scott* wants to know where youd like to take the Paper Company investors to dinner tonight.\\n\\n *Please select a restaurant:*\" } }, { \"type\": \"divider\" }, { \"type\": \"section\", \"text\": { \"type\": \"mrkdwn\", \"text\": \"*Farmhouse aThai Cuisine*\\n:star::star::star::star: 1528 reviews\\n They do have some vegan options, like the roti and curry, plus they have a ton of salad stuff and noodles can be ordered without meat!! They have something for everyone here\" }, \"accessory\": { \"type\": \"image\", \"image_url\": \"https://s3-media3.fl.yelpcdn.com/bphoto/c7ed05m9lC2EmA3Aruue7A/o.jpg\", \"alt_text\": \"alt text for image\" } }, { \"type\": \"section\", \"text\": { \"type\": \"mrkdwn\", \"text\": \"*Kin Khao*\\n:star::star::star::star: 1638 reviews\\n The sticky rice also goes wonderfully with the caramelized pork belly, which is absolutely melt-in-your-mouth and so soft.\" }, \"accessory\": { \"type\": \"image\", \"image_url\": \"https://s3-media2.fl.yelpcdn.com/bphoto/korel-1YjNtFtJlMTaC26A/o.jpg\", \"alt_text\": \"alt text for image\" } }, { \"type\": \"section\", \"text\": { \"type\": \"mrkdwn\", \"text\": \"*Ler Ros*\\n:star::star::star::star: 2082 reviews\\n I would really recommend the  Yum Koh Moo Yang - Spicy lime dressing and roasted quick marinated pork shoulder, basil leaves, chili & rice powder.\" }, \"accessory\": { \"type\": \"image\", \"image_url\": \"https://s3-media2.fl.yelpcdn.com/bphoto/DawwNigKJ2ckPeDeDM7jAg/o.jpg\", \"alt_text\": \"alt text for image\" } }, { \"type\": \"divider\" } ] }' --command 'SlackJson' --workspace \"ringier-southafrica\" --channel \"pe-test\"\n```\n\n### Python\n\n```\nfrom ritdu_slacker.api import SlackClient\nclient = SlackClient()\nclient.post_message(\"via python api\",\"ringier-southafrica\",\"#pe-alerts\")\n{'message_uuid': '9890b802-fac3-4e61-bbe8-b53cc17fc581', 'message_ts': '1677473299.255969', 'thread_uuid': '9890b802-fac3-4e61-bbe8-b53cc17fc581', 'thread_ts': '1677473299.255969', 'channel': 'CV3JFH08J'}\nclient.post_message(datajson,\"ringier-southafrica\",\"pe-test\",command=\"SlackJson\")\n```\n\n## Development\n\nTo setup your development environment:\n\n```\n$ make setup-dev\n```\n\nRunning make on its own generates help documentation:\n\n```\n$ make\nbuild                Build the package\ncheck                Check the package\nclean                Clean the package\nformat               Format the code\ninstall-dev          Setup development environment\ninstall-prod         Install production dependencies\ninstall              Install all dependencies\nlint                 Lint the code\nlock                 Update dependency lockfile\npublish-test         Publish to the package to the PyPI test platform\npublish              Publish the package\nsetup-binaries       Setup binaries for development. Poetry, Twine.\ntest                 Test the package\nvscode               Update VSCode settings\n```\n\nPlease read the _Makefile_ to see what each task does.\n\n## Deployment\nTo deploy a new version of the package to PyPI, you need to bump the version in the _pyproject.toml_ file and then push the tag (prefixed by v) to the repository.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Simple internal Slack API wrapper",
    "version": "1.5.2",
    "project_urls": {
        "Homepage": "https://github.com/RingierIMU/ritdu-slacker/",
        "Repository": "https://github.com/RingierIMU/ritdu-slacker/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "caedfd3bba2915cfdfc4c31de3db21886e8321f3cc2aa24fdb960cc0ca1b83ff",
                "md5": "f99d654e6a2c05a8c5b849ff3c6d95d9",
                "sha256": "ac56d10112a69073735a1982426f76382e0400d668e5d9c99c71641e34eebcd0"
            },
            "downloads": -1,
            "filename": "ritdu_slacker-1.5.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f99d654e6a2c05a8c5b849ff3c6d95d9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 7586,
            "upload_time": "2024-05-14T15:27:53",
            "upload_time_iso_8601": "2024-05-14T15:27:53.122530Z",
            "url": "https://files.pythonhosted.org/packages/ca/ed/fd3bba2915cfdfc4c31de3db21886e8321f3cc2aa24fdb960cc0ca1b83ff/ritdu_slacker-1.5.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "aae976489826ea81aeefdbde1dd7814a61240ec47a9e145b96632926959ac459",
                "md5": "d0e8a4e7460b1376270086fa42c635d1",
                "sha256": "e2aca8726138b46e3dfb870c18833b4f4d60320dd6192e165f44b770841cc409"
            },
            "downloads": -1,
            "filename": "ritdu_slacker-1.5.2.tar.gz",
            "has_sig": false,
            "md5_digest": "d0e8a4e7460b1376270086fa42c635d1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 6070,
            "upload_time": "2024-05-14T15:27:54",
            "upload_time_iso_8601": "2024-05-14T15:27:54.293855Z",
            "url": "https://files.pythonhosted.org/packages/aa/e9/76489826ea81aeefdbde1dd7814a61240ec47a9e145b96632926959ac459/ritdu_slacker-1.5.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-14 15:27:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "RingierIMU",
    "github_project": "ritdu-slacker",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "ritdu-slacker"
}
        
Elapsed time: 0.26293s