Skip to main content

发送企业微信应用消息

Project description

msgqywx

使用企业微信的应用消息推送实时信息

注:markdown支持无法在微信中查看

Install

pip install msgqywx

Params

  • corpid: 企业ID,在管理后台获取
  • corpsecret: 自建应用的Secret,每个自建应用里都有单独的secret
  • agentid: 应用ID,在后台应用中获取
  • touser: 接收者用户名(微信账号),多个用户用|分割,与发送消息的touser至少存在一个

Usage

from msgqywx import msgqywx

if __name__ == '__main__':
    wx = msgqywx(corpid='ww7e42424723224ba8ff49',
                 corpsecret='we0YB4242424242_J2332PnmA',
                 agentid='2115353',
                 touser='xxxxxxxxxx',
                 )
    wx.send_msg("这是测试信息")  # 使用初始类的touser
    wx.send_msg("这是另一个测试消息", touser="xxxxx")  # 自定义接收的账号

    md_text = """您的会议室已经预定,稍后会同步到`邮箱`
                >**事项详情**
                >事 项:<font color=\"info\">开会</font>
                >组织者:@miglioguan
                >参与者:@miglioguan、@kunliu、@jamdeezhou、@kanexiong、@kisonwang
                >
                >会议室:<font color=\"info\">广州TIT 1楼 301</font>
                >日 期:<font color=\"warning\">2018年5月18日</font>
                >时 间:<font color=\"comment\">上午9:00-11:00</font>
                >
                >请准时参加会议。
                >
                >如需修改会议信息,请点击:[修改会议信息](https://work.weixin.qq.com)"""
    wx.send_msg(md_text, msgtype="markdown", raise_error=True)  # 发送markdown消息,注意markdown消息仅企业微信可接收

Limit

基础频率

每企业调用单个cgi/api不可超过1万次/分,15万次/小时;
每ip调用单个cgi/api不可超过2万次/分,60万次/小时;
第三方应用提供商每ip调用单个cgi/api不可超过4万次/分,120万次/小时;

发送应用消息频率

每应用不可超过帐号上限数*200人次/天(注:若调用api一次发给1000人,算1000人次;若企业帐号上限是500人,则每个应用每天可发送100000人次的消息);
每应用对同一个成员不可超过30次/分钟,超过部分会被丢弃不下发;
发消息频率不计入基础频率;

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

msgqywx-0.3.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

msgqywx-0.3.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file msgqywx-0.3.0.tar.gz.

File metadata

  • Download URL: msgqywx-0.3.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.12

File hashes

Hashes for msgqywx-0.3.0.tar.gz
Algorithm Hash digest
SHA256 0f26bd148d3b0686c8f404551fba95415d79a31753c499675fa3b7efd7277df7
MD5 ea4a5c485639ee74f2ffc0f18e3b23a0
BLAKE2b-256 028041c361bba7be249a841ce9afda327a439ec8e3bd11e2f542c2e3d4fed566

See more details on using hashes here.

File details

Details for the file msgqywx-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: msgqywx-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.12

File hashes

Hashes for msgqywx-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f828a460718969e7c9a4e1b1f1a9272fb540074992f811514037098a5e3ee2aa
MD5 2ec2daf7c47fc13d4c52b06db3b4f07e
BLAKE2b-256 820023f777ca1953c915ab9a194fd774db66389ee129cb4773ca64561954ca5c

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