Work wechat log notify.
Project description
Work wechat log notify.
WorkWechatLog(webhook_urls: str | List[str], mode: bool) 企业微信日志类
webhook_urls{str|List[str]} webhook链接地址,可传字符串或者字符串列表mode{bool} 是否测试模式,测试模式使用print输出 True: 测试模式 False: 生产模式
example:
log = WorkWechatLog("https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", False)
# 或
log = WorkWechatLog(
[
"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
],
False
)
text(msg: str, mentioned_list: List[str], mentioned_mobile_list: List[str]) 发送文本消息
msg{str} 文本内容,最长不超过2048个字节,必须是utf8编码mentioned_list{List[str]} userid的列表,提醒群中的指定成员(@某个成员),@all表示提醒所有人,如果开发者获取不到userid,可以使用mentioned_mobile_listmentioned_mobile_list{List[str]} 手机号列表,提醒手机号对应的群成员(@某个成员),@all表示提醒所有人- returns {None}
example:
from work_wechat_log.log import WorkWechatLog
log = WorkWechatLog(webhook_urls, False)
log.text("haha", ["@all"])
markdown(msg: str) 发送markdown消息
msg{str} 文本内容,最长不超过2048个字节,必须是utf8编码mentioned_list{List[str]} userid的列表,提醒群中的指定成员(@某个成员),@all表示提醒所有人,如果开发者获取不到userid,可以使用mentioned_mobile_listmentioned_mobile_list{List[str]} 手机号列表,提醒手机号对应的群成员(@某个成员),@all表示提醒所有人- returns {None}
example:
from work_wechat_log.log import WorkWechatLog
log = WorkWechatLog(webhook_urls, False)
log.markdown("###实时新增用户反馈<font color=\"warning\">132例</font>")
image(image_path: str) 发送图片消息
image_path{str} 图片地址,图片最大不能超过2M- returns {None}
example:
from work_wechat_log.log import WorkWechatLog
log = WorkWechatLog(webhook_urls, False)
log.image("./tmp/test.png")
table(table: TableType, headers: TableHeadersType = (), tablefmt: TableFmtType = "simple") 发送表格消息
- @see https://pypi.org/project/tabulate/
- 参数都和
tabulate一样 - returns {None}
测试模式使用tabulate输出表格,生产模式会转化为image发送
example:
from work_wechat_log.log import WorkWechatLog
log = WorkWechatLog(webhook_urls, False)
table = [["spam",42],["eggs",451],["bacon",0]]
headers = ["item", "qty"]
log.table(table, headers, "simple_grid")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file work_wechat_log_notify-0.2.1.tar.gz.
File metadata
- Download URL: work_wechat_log_notify-0.2.1.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5a423a26c5f22c208e1fec271faaa77717cfa119f40ecfacb0368e6bee5a4f6
|
|
| MD5 |
2019208169a80376100346d854cc113d
|
|
| BLAKE2b-256 |
04f52df05613d09c4ad9fbd12711ee92074edc5bbe0242f18186cdb32c190dcd
|
File details
Details for the file work_wechat_log_notify-0.2.1-py3-none-any.whl.
File metadata
- Download URL: work_wechat_log_notify-0.2.1-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87fe8f2d7410dee1bdc57aed92f6502ba60ed89ccb2af1097119d313a01178e6
|
|
| MD5 |
38ba7b2a216d6d9510ccd41d3e11cf15
|
|
| BLAKE2b-256 |
7a158d30e77044f3062374d13bf9ba7ee68df4d00364a03e8ab84f5499032612
|