Skip to content
Post print output from python code into Slack
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
LICENSE.txt
README.md
setup.py

README.md

kamebot 🐢

  • Python3
  • using slacker
  • printで出力したものをSlackに投げる
  • kamebot自体でargparseを使っているので、parse_known_args()を使う必要がある

How to install

  1. Install via pip
    $ pip install git+https://github.com/masaponto/kamebot  
    
  2. Add KAMEBOT_TOKEN to your shell
    $ echo 'export KAMEBOT_TOKEN=<your-slack-api-token-goes-here>' >> ~/.zshenv
    
    slack api token is from bots

Examples

Write example.py as follows

from kamebot import Kamebot

kame = Kamebot(channel='#random', error_comment='Yabai!!!!!!!')

# send print string as a comment
@kame.comment
def main():
    print('this is a test')

if __name__ == "__main__":
    main()

and Run

$ python example.py

if you want send as a file

from kamebot import Kamebot

kame = Kamebot(channel='#random', error_comment='Yabai!!!!!!!')

# send print string as a file
@kame.afile
def main():
    print('this is a test')

if __name__ == "__main__":
    main()

then Run

$ python example.py -of=your_output_file.txt -cm comment

Options

  • -test : if you want to use stdio for test run
only for @kame.afile
  • -cm, --comment : initial comment for upload file
  • -of, --outfile : output file name

License

MIT

You can’t perform that action at this time.