功能
- 发送消息到企业微信机器人。
- 支持所有企业微信机器人消息类型。
- 企业微信机器人
安装
1. 安装该模块
pip install wechatrobot
使用
-
获取微信机器人的
key创建机器人时,会返回一个
webhook的地址,如https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5cb94c2b-1238-4414-b830-a521523d7a,则key为5cb94c2b-1238-4414-b830-a521523d7a
-
使用
key = '5cb94c2b-1238-4414-b830-a521523d7a' import wechatrobot wxrobot = wechatrobot.WechatRobot(key)
-
发送文本消息
# 签名 wxrobot.send_text(content, at_mobiles=None) # content 为要发送的文本内容 # at_mobiles 需要 @ 人的手机号,可以是列表或字符串(多个人使用逗号分隔)。如果要 @所有人,则设置 at_mobiles='all'。@ 多个人时,指定 at_mobiles='18600000000,18600000001'
-
发送
markdown消息# 签名 wxrobot.send_markdown(contents) # 如果 contents 为列表、元组, 每一行为一个 markdown 格式的字符串。默认会在每个元素后增加一个 '\n' 换行符。 # 如果 contents 是字符串,则用户自己控制markdown的格式。 # 支持的格式参考:https://work.weixin.qq.com/api/doc/90000/90136/91770#markdown%E7%B1%BB%E5%9E%8B
-
发送图片
# 签名 wxrobot.send_image(image_path) # image_path 支持 HTTP、HTTPS、FTP,互联网上的图片URL。也支持本地的图片路径。 # 如 wxrobot.send_image('https://img1.maka.im/template/T_G29KRHKN_t1.jpg')
-
发送图文类型
# 签名 wxrobot.send_news(news_title, jump_url, picurl=None, news_description=None) # news_title 消息标题 # jump_url 跳转url # picurl 图片的url # news_description 消息描述
-
发送文件
# 签名 wxrobot.send_file(file_path) # file_path 要上传的本地文件路径。大小不能超过20M
Metadata
Release files for wechatrobot 1.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wechatrobot-1.0.6-py3-none-any.whl | Python 3 | none | any | Details for wechatrobot-1.0.6-py3-none-any.whl |
Release files / wechatrobot-1.0.6-py3-none-any.whl
| Download URL | wechatrobot-1.0.6-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
46e4ca4875743e0584606953099f17e35a5a82b9ca0c1f8c084b4a220be4a691
|
|
BLAKE2b-256 checksum How to use checksums |
7aa1738acb8d8b16a4537370ebe8cb18409f0f0c4be7cf768a10b3b25f6972f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.2
|
Security for wechatrobot 1.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.