Python send WeChat message

 

For this, you need to install the itchat third-party module

Just install it with pip pip install itchat

 

 

 

import itchat 
import time #Introduce
the time function for testing
time_format='%Y-%d-%m %X'
time_current=time.strftime(time_format)

#itchat.auto_login()#python login Scan QR code Required for each login Generate QR code
itchat.auto_login(hotReload = True) #Do you need to scan after the first scan? To be tested
users=itchat.search_friends("Wang Haowen")
userName= users[0]['UserName']
itchat.send('Hello Wang Haowen,now is %s'%time_current,toUserName=userName)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324884292&siteId=291194637