Skip to main content

WeChat Work Message Bot.

Project description

Python API for WeChat Work Message Bot

企业微信群机器人 Python 接口和命令行工具。

About the name: v = WeChat, me = Me, vme = WeChat Me. It's somewhat inspired by Chinese Internet meme "VME50".

vme is listed on PyPI.

vme is dependency-free.

Python API

vme.send() sends text (str) or image (bytes). Due to limitations of WeChat Work, only PNG and JPG images under 2M size are allowed. Image is recognized by detecting first few bytes (magic bits) of the binary data. An exception will be raised if payload is neither text nor image.

All texts are sent as markdown. Please note that the markdown features WeChat Work supports are extremely limited.

vme.send_file() is not implemented yet.

import vme

# send text
vme.send('your-bot-key', 'Texts with `minimal markdown` support.')

# send image, only PNG or JPG are supported
image = plot_some_curve(...)
vme.send('your-bot-key', image)

# send file (NOT implemented yet)
vme.send_file('your-bot-key', '/path/to/your/file')

Command Line Tool

vme is runnable with python3 -m vme command line.

Send text or image

Text or image data can only be read through pipe or input redirection:

# sending texts from another process
echo "hello world" | python3.8 -m vme your-bot-key

# sending an image from file
python3.8 -m vme your-bot-key < plot.png

# sending long texts in a file
python3.8 -m vme your-bot-key < message.txt

# sending image from another process
my-plot --stdout ... | python3.8 -m vme your-bot-key

Send file

Althrough the API is still not implemented yet, command line semantic for "send this file as a file" is designed.

# sending a file
python3.8 -m vme your-bot-key /path/to/your/file

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

vme-0.0.3-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file vme-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: vme-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for vme-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ac716480f2e18be8b89e4a3a58dae7a3d8eb02f24093fdc9b2ee7f8bd040e0af
MD5 f5b97304e4adad88a41b3fc0488e6fbb
BLAKE2b-256 fb42211a38d1ee308a33a3232aa4fc5aa26562d56542ab2ce7f76a97ab525385

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