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.7.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

msgqywx-0.7.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: msgqywx-0.7.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for msgqywx-0.7.0.tar.gz
Algorithm Hash digest
SHA256 a40ea9fbb5536a59a13161dacbf6639e749625bea4909b065c36100447b4ba80
MD5 88fcba97aac3b4036e4443e181410f36
BLAKE2b-256 265a267d678480db8533dd68cd60d49e1745ea998a0374bcbc51ef6696c32e68

See more details on using hashes here.

File details

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

File metadata

  • Download URL: msgqywx-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for msgqywx-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 410c963eb2ff8ac61631c80b324685551601faacf7bc81eee6c32bd18262e9f4
MD5 bee85a4e164585235358c173bcc6d6be
BLAKE2b-256 c69bf1f6b78a0ec0653bc5054525bed159d0148bffb42ea6e6fb69d4b368393a

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