Send messages to WeChat anytime, anywhere
http://wechat-sender.readthedocs.io/zh_CN/latest/
wechat_sender is a tool implemented based on wxpy and tornado that can send various messages (logs, alarms, running results, etc.) from your website, crawlers, scripts and other applications to WeChat
wxpy provides a relatively complete WeChat personal account API based on itchat, and I want to use personal WeChat to receive alarm information from my website and some crawler results, so I wrote this tool.
pip install wechat_sender
Python 2.7 and above Python 3 and above
from wxpy import *
from wechat_sender import *
bot = Bot ()
listen ( bot )
# 之后 wechat_sender 将持续运行等待接收外部消息
from wechat_sender import Sender
Sender (). send ( 'Hello From Wechat Sender' )
# Hello From Wechat Sender 这条消息将通过 1 中登录微信的文件助手发送给你
If you are a wxpy user, just change one sentence to use wechat_sender:
For example, this is your original code:
# coding: utf-8
from __future__ import unicode_literals
from wxpy import *
bot = Bot ( 'bot.pkl' )
my_friend = bot . friends (). search ( 'xxx' )[ 0 ]
my_friend . send ( 'Hello WeChat!' )
@ bot . register ( Friend )
def reply_test ( msg ):
msg . reply ( 'test' )
bot . join ()
Use wechat_sender:
# coding: utf-8
from __future__ import unicode_literals
from wxpy import *
from wechat_sender import listen
bot = Bot ( 'bot.pkl' )
my_friend = bot . friends (). search ( 'xxx' )[ 0 ]
my_friend . send ( 'Hello WeChat!' )
@ bot . register ( Friend )
def reply_test ( msg ):
msg . reply ( 'test' )
listen ( bot ) # 只需改变最后一行代码
Later, if you want to send WeChat messages in other programs or scripts, just:
# coding: utf-8
from wechat_sender import Sender
Sender (). send ( "test message" )
http://wechat-sender.readthedocs.io/zh_CN/latest/
Scan the QR code, verify the information and enter 'wechat_sender' or 'add group' to enter the WeChat communication group
Current version: 0.1.4
2017.06.12 0.1.4:
Fix the problem of error reported by sender after successful sending under Python 3 #8
Sender().send_to method adds support for search group sending
Sender supports specifying multiple receivers
2017.06.07 0.1.3:
Optimize code, improve documentation and comments
2017.06.04 0.1.2:
Fixed the issue of sender timeout being too short;
Fixed the problem of error reporting when initializing listen without receiver
Add LoggingSenderHandler to provide log handler support
2017.05.27 0.1.1:
Add multiple receiver support;
2017.05.27 0.1.0:
Add delayed message;
Add periodic messages;
Add designated recipient message;
Add wechat_sender control command;
Add wxpy status monitoring function;
Optimize code;
2017.05.17 0.0.2:
Optimize code
2017.05.11 0.0.1:
Release first version