python_webapi: [https://nomuraya.work/techzine/0191, https://shimajima-eiji.github.io/gist/python_webapi/]
# coding: utf-8
# server/send.py
def execute(message):
import requests, json
WEB_HOOK_URL = "(Slack Incomming Web hook URL)"
requests.post(WEB_HOOK_URL, data = json.dumps({
'text': 'user action :{}'.format(message),
'usern
# need: python3
# https://nomuraya.work/develop/cmd/python
pip3 install hug
#after create process (run_hug.py)
hug -f (run_hug.py)
https://nomuraya.work/techzine/0191
# システム監視スクリプトを実行していてアラートが発生した時に動かす
# server.shは動かしておくこと
apt install curl
curl http://localhost:8000/send?message=$1
#!/usr/bin/env python3
import hug
@hug.get('/send')
def send(mes):
from server import send
send.execute(mes)
# need: python3
# https://nomuraya.work/develop/cmd/python
pip3 install hug
#after create process (run_hug.py)
hug -f (run_hug.py)
# coding: utf-8
# server/send.py
def execute(message):
import requests, json
WEB_HOOK_URL = "(Slack Incomming Web hook URL)"
requests.post(WEB_HOOK_URL, data = json.dumps({
'text': 'user action :{}'.format(message),
'usern
#!/usr/bin/env python3
import hug
@hug.get('/send')
def send(mes):
from server import send
send.execute(mes)
# システム監視スクリプトを実行していてアラートが発生した時に動かす
# server.shは動かしておくこと
apt install curl
curl http://localhost:8000/send?message=$1
https://nomuraya.work/techzine/0191