Skip to main content

Python API for DingDing Group Robot.

Project description

cgai-DD

介绍

钉钉群机器人的python API接口

安装教程

pip install cgai-DD

注意

1.仅支持python3
2.发送的图片路径必须是网络路径
3.发送的图片格式图必须是jpg格式

使用案例

import cgai_DD as dd
WEBHOOK = 'https://oapi.dingtalk.com/robot/send?access_token=xxxxxx'
发送文本信息
dd.sendMessage(WEBHOOK,'发送的内容')
发送连接
message_url = r'https://zhuanlan.zhihu.com/p/391348944'
title = 'CGAI-time'
text = 'cgai-time一个简单又实用的时间日期处理python库'
pic_url = 'https://obohe.com/i/2021/08/06/ikclyn.jpg'

dd.sendLink(WEBHOOK,message_url,title,text,pic_url)
发送markdown
pic_url = 'https://obohe.com/i/2021/08/06/e1qrsr.png'
markdown = """
## cgai-time一个简单又实用的时间日期处理python库
体育老师再也不用担心我算不出时间了
![img](https://obohe.com/i/2021/08/06/ikclyn.jpg)
###### 帮助说明 [链接](https://zhuanlan.zhihu.com/p/391348944)
"""
title = 'cgai-time分享'

dd.sendMarkdown(WEBHOOK,markdown,title)
发送ActionCard
markdown = """
![img](https://obohe.com/i/2021/08/06/ikclyn.jpg)
### cgai-time
"""
showTitle = 'cgai-time'
singleTitle = '阅读文章'
url = 'https://zhuanlan.zhihu.com/p/391348944'
dd.sendActionCard(WEBHOOK,markdown,showTitle,singleTitle,url,btnOrientation=1)


btns = [{"title":'链接1',"actionURL":url},{"title":'链接2',"actionURL":url}]
dd.sendActionsCard(WEBHOOK,markdown,showTitle,singleTitle,url,btns,btnOrientation=0)
发送Freecard
url = 'https://zhuanlan.zhihu.com/p/391348944'
pic_url = 'https://obohe.com/i/2021/08/06/ikclyn.jpg'

links = [{"title":"标题1","messageURL":url,"picURL":pic_url},
         {"title":"标题2","messageURL":url,"picURL":pic_url}]

dd.sendFreeCard(WEBHOOK,links)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cgai_DD-0.0.1.tar.gz (3.2 kB view details)

Uploaded Source

File details

Details for the file cgai_DD-0.0.1.tar.gz.

File metadata

  • Download URL: cgai_DD-0.0.1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.1

File hashes

Hashes for cgai_DD-0.0.1.tar.gz
Algorithm Hash digest
SHA256 0cdda387795d7b6d392616f085f4725d10b4a8354dcd3a7ca758b959f18d8cee
MD5 d5b3452e7c7a011fdba841bc09dffc7c
BLAKE2b-256 a2edd56c8580925460ea70f075c2c37e68e313acfd08ad6520c1bdb135b9cc37

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page