feat(platform): add dingtalk eba adapter

This commit is contained in:
Junyan Qin
2026-05-10 19:52:36 +08:00
parent 3ed35593e9
commit 950da65797
18 changed files with 1256 additions and 151 deletions

View File

@@ -438,8 +438,13 @@ class DingTalkClient:
try:
async with httpx.AsyncClient() as client:
response = await client.post(url, headers=headers, json=data)
try:
body = response.json()
except Exception:
body = {'text': response.text}
if response.status_code == 200:
return
return body
raise Exception(f'Error: {response.status_code}, {body}')
except Exception:
await self.logger.error(f'failed to send proactive massage to person: {traceback.format_exc()}')
raise Exception(f'failed to send proactive massage to person: {traceback.format_exc()}')
@@ -464,8 +469,13 @@ class DingTalkClient:
try:
async with httpx.AsyncClient() as client:
response = await client.post(url, headers=headers, json=data)
try:
body = response.json()
except Exception:
body = {'text': response.text}
if response.status_code == 200:
return
return body
raise Exception(f'Error: {response.status_code}, {body}')
except Exception:
await self.logger.error(f'failed to send proactive massage to group: {traceback.format_exc()}')
raise Exception(f'failed to send proactive massage to group: {traceback.format_exc()}')