from __future__ import print_function# Created by sarathkaul on 11/11/19import jsonimport 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)# )
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。