Created
August 6, 2019 19:45
-
-
Save kojira/dd3e91d8e24f57055a87214d1f648613 to your computer and use it in GitHub Desktop.
標準入力から受けた文字列をwebhookに投げるやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
def post_webhook(name, content): | |
request = { | |
"username": "", | |
"content": "" | |
} | |
headers = {'content-type': 'application/json'} | |
url="replace webhookurl" | |
request['username'] = name | |
request['content'] = content | |
response = requests.post(url, data=json.dumps(request), headers=headers) | |
import sys | |
index = 0 | |
text = "" | |
for line in iter(sys.stdin.readline, ""): | |
text += line | |
post_webhook("hoge",text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment