Skip to main content

No project description provided

Project description

用 Python 发送企业微信消息

支持发送:

  • 文本
  • 文件
  • 图片
  • MarkDown

安装

pip install wechat-enterprise-sdk

使用

获取的 access_token 会保存在 ./tmp/cache.json 里面,避免高频率获取 access_token。

from wechat_enterprise import WechatEnterprise
we = WechatEnterprise(
    corpid="ww2563f***********",  # 企业 ID
    appid="100****3",  # 企业应用 ID
    corpsecret="*********************",  # 企业应用 Secret
)

#接收者 ID,在企业微信通讯录中查看
receivers = ["ZhengZheng", "DaZhengGe"]
# 发送 文本
re = we.send_text("来息 somenzz 的消息", receivers)
re 就是企业微信返回的数据用于判断发送是否成功或失败的原因
# 发送 Markdown
we.send_markdown("# Markdown", receivers)
# 发送图片
we.send_image("/Users/aaron/Downloads/images.jpeg", receivers)
# 发送文件
we.send_file("./wechat_enterprise.py", receivers)
# 根据手机号获取企业微信账号:
userid = we.get_userid("138********")
we.send_text("hello",[userid,])

todo

添加企业微信的其他实用功能

联系我

添加微信 「somenzz-enjoy」 备注 「github」

个人公众号 「Python七号」,微信搜一搜关注。

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

wechat_enterprise_sdk-0.4.4.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wechat_enterprise_sdk-0.4.4-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file wechat_enterprise_sdk-0.4.4.tar.gz.

File metadata

  • Download URL: wechat_enterprise_sdk-0.4.4.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for wechat_enterprise_sdk-0.4.4.tar.gz
Algorithm Hash digest
SHA256 7f0d11153a409fe26283a434f15a51380cc326131a246d67d9b6b0521a7baa70
MD5 5e2ac18a02ed0bfac7d8665acaa8fe3b
BLAKE2b-256 f441718b7384b935e6c0459fac31cedcea8423bcbc1d81e005819c83f1ac9210

See more details on using hashes here.

File details

Details for the file wechat_enterprise_sdk-0.4.4-py3-none-any.whl.

File metadata

File hashes

Hashes for wechat_enterprise_sdk-0.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6c5e0ad974918d656489f44abd647f46ba33b8b912dab81eecc768e66f406291
MD5 e87b810d50908311d30cc12cca41b761
BLAKE2b-256 f451a73a3975e1e64803cbf9a98cce7fdabed57777b63b0310e2f12b2aaadb6d

See more details on using hashes here.

Supported by

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