1 Star 0 Fork 0

wdc/Python001

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
slack_message.py 703 Bytes
一键复制 编辑 原始数据 按行查看 历史
from __future__ import print_function
# Created by sarathkaul on 11/11/19
import json
import urllib.request
# Set the webhook_url to the one provided by Slack when you create the webhook at https://my.slack.com/services/new/incoming-webhook/
webhook_url = 'https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX'
slack_data = {'text': "Hi Sarath Kaul"}
response = urllib.request.Request(webhook_url, data=json.dumps(slack_data),headers={'Content-Type': 'application/json'})
print(response)
# if response.status_code != 200:
# raise ValueError(
# 'Request to slack returned an error %s, the response is:\n%s'
# % (response.status_code, response.text)
# )
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ijiwei/Python001.git
git@gitee.com:ijiwei/Python001.git
ijiwei
Python001
Python001
master

搜索帮助