mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-12 08:46:02 +00:00
feat(platform): add dingtalk eba adapter
This commit is contained in:
@@ -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()}')
|
||||
|
||||
Reference in New Issue
Block a user