forked from uzdz/114_robot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dingding.py
36 lines (24 loc) · 1014 Bytes
/
dingding.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from dingtalkchatbot.chatbot import DingtalkChatbot
def create_monitor_flow(content):
# webhook 通过钉钉群添加机器人可获取
webhook = ''
if webhook == '':
return
xiaoding = DingtalkChatbot(webhook)
xiaoding.send_markdown(title='数据监控', text=content, is_at_all=True)
def send(mark_available=list):
if mark_available is None:
return
if isinstance(mark_available, list):
if len(mark_available) <= 0:
return
for single in mark_available:
hos_name = single["hosName"]
first_dept_name = single["firstDeptName"]
second_dept_name = single["secondDeptName"]
yuyue = single["yuyue"]
if len(yuyue) <= 0:
continue
content = '#### ****[114] 可预约提醒 %s**** \n *****%s***** - *****%s***** \n' % (hos_name, first_dept_name, second_dept_name)
content = content + "".join(yuyue)
create_monitor_flow(content)