Skip to main content

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_list
  • mentioned_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_list
  • mentioned_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") 发送表格消息

测试模式使用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")

file(file_path: str) 发送文件消息

  • file_path {str} 文件地址,要求文件大小在5B~20M之间
  • returns {None}

example:

from work_wechat_log.log import WorkWechatLog

log = WorkWechatLog(webhook_urls, False)
log.file("./tmp/test.pdf")

Metadata

Release files for work-wechat-log-notify 0.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for work-wechat-log-notify 0.2.6
File Size Uploaded Provenance Actions
work_wechat_log_notify-0.2.6.tar.gz 5.8 kB Without provenance Details for work_wechat_log_notify-0.2.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for work-wechat-log-notify 0.2.6
File Interpreter ABI Platform Actions
work_wechat_log_notify-0.2.6-py3-none-any.whl Python 3 none any Details for work_wechat_log_notify-0.2.6-py3-none-any.whl

Total release size: 12.9 kB

Release files / work_wechat_log_notify-0.2.6.tar.gz

Download URL work_wechat_log_notify-0.2.6.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
382bc4ad8ec8178faba1f82edc0f1f3c155b0ff8442d3fcf42d9d4fc5f928894
BLAKE2b-256 checksum
How to use checksums
0f23ea4155056a302883f84857e29a5949b415e5cee313746036128653e7a6f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.5

Release files / work_wechat_log_notify-0.2.6-py3-none-any.whl

Download URL work_wechat_log_notify-0.2.6-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7958d68de17f73759322d1e5e9164b71c156aee36a23b552cdedd68214f6d29a
BLAKE2b-256 checksum
How to use checksums
e665325910c320631667a496f8f455326fe2ce90bbefb3a24dc6f10dc649b470
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.5

Security for work-wechat-log-notify 0.2.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page