优化连接不上时创建表

This commit is contained in:
z66
2025-11-05 09:50:55 +08:00
parent 4154eb452f
commit b0bf0fa9bc
4 changed files with 191 additions and 23 deletions
+22 -11
View File
@@ -27,15 +27,26 @@ class DingAPI():
return token
def send_message(self, message):
data = {
"msgtype": "text",
"text": {
"content": message
def card_create(self, data):
"""
创建并投放卡片
return: response(dict)
"""
url = 'https://api.dingtalk.com/v1.0/card/instances/createAndDeliver'
headers = {
'x-acs-dingtalk-access-token': data["token"],
'Content-Type': 'application/json'
}
}
headers = {
'Content-Type': 'application/json'
}
response = requests.post(self.url, json=data, headers=headers)
return response.status_code
data = {
"cardTemplateId": "cee2715f-001d-41cb-8fcd-3be18be9fbf5.schema",
"outTrackId": "",
"cardData":"",
"openSpaceId":"dtv1.card//IM_GROUP.4210192048793363",# 场域id
}
response = requests.post(url, json=data, headers=headers)
return response.json()
def get_