企业微信群机器人
Project description
Work Weixin Robot
企业微信群机器人
Installation
pip install WorkWeixinRobot
Usage
Command
Usage: wwx-robot -k <robot_key> -t <msg_type> -d <msg_data> -f <msg_file_path>
Option:
-k Robot key
-t Message type
text, markdown, image, news
-d Message data
-f Message file
+--------------+--------------+
| Message Type | File Type |
+--------------+--------------+
| text | text |
+--------------+--------------+
| markdown | markdown |
+--------------+--------------+
| image | jpg,png |
+--------------+--------------+
| news | yaml |
+--------------+--------------+
Example:
wwx-robot -k xxxx -t text -d "Hello world"
wwx-robot -k xxxx -t markdown -f demo/help.md
wwx-robot -k xxxx -t image -f demo/picture.jpg
wwx-robot -k xxxx -t news -f demo/articles.yaml
Message File Template:
help.md
## Weixin MSG
How to use this tool
articles.yaml
- title: 'Article I'
description: 'Article I Description' # Optional
url: 'URL I'
picurl: 'Article I Picture URL' # Optional
- title: 'Article II'
description: 'Article II Description' # Optional
url: 'URL II'
picurl: 'Article II Picture URL' # Optional
Python
Init a weixin robot
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from WorkWeixinRobot.work_weixin_robot import WWXRobot
wwxrbt = WWXRobot(key='Robot Key')
Send Text Message
wwxrbt.send_text(content='Hello')
Send Markdown Message
wwxrbt.send_markdown(content='Hello')
Send Image Message
# Method I: Send local image
wwxrbt.send_image(local_file='local_image.jpg')
# Method II: Send remote URL image
wwxrbt.send_image(remote_url='https://office.baoxian-sz.com/assets/img/logo_logo_zhenxinhuaxian_tiw_600_150.png')
Send Articles Message [ Image + Text ]
articles = [
{
'title': 'Article I',
'description': 'Article I Description', # Optional
'url': 'URL I',
'picurl': 'Article I Picture URL', # Optional
},
{
'title': 'Article II',
'description': 'Article II Description', # Optional
'url': 'URL II',
'picurl': 'Article II Picture URL', # Optional
}
]
wwxrbt.send_news(articles=articles)
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
WorkWeixinRobot-1.0.1.tar.gz
(4.3 kB
view details)
Built Distribution
File details
Details for the file WorkWeixinRobot-1.0.1.tar.gz
.
File metadata
- Download URL: WorkWeixinRobot-1.0.1.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54d19a1602103baf6ccfbccb28c601af81fdcd4f484bc25f00b3880c50d96f72 |
|
MD5 | 4e2a3fc0c780b3b219c5b94853292dca |
|
BLAKE2b-256 | 8bc58790550e5ea2b38f1f52eda9dfc3744024848f58eea185ad59a4874c652c |
File details
Details for the file WorkWeixinRobot-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: WorkWeixinRobot-1.0.1-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f19a715f37a7f03f441a7b9d05d4cebc6b47b61bf6608f9c47ca2308c2152b31 |
|
MD5 | 7c6c5b8c29a29f2bf04d10e9a5b48b47 |
|
BLAKE2b-256 | 3c2170aa5f51397b0c38932b556587116d51e874211d03d3ceeff7f923f65801 |