• 大小: 1.25KB
    文件类型: .py
    金币: 1
    下载: 0 次
    发布日期: 2021-01-30
  • 语言: Python
  • 标签: python  自动  微信  

资源简介

利用python语言编写微信自动回复功能

资源截图

代码片段和文件信息

import itchat
import requests
import re
# 抓取网页
def getHtmlText(url):
       try:
               r = requests.get(urltimeout=30)
               r.raise_for_status()
               r.encoding = r.apparent_encoding
               return r.text
       except:
               return ““
# 自动回复
# 封装好的装饰器,当接收到的消息是Text,即文字消息
@itchat.msg_register([‘Text‘‘Map‘ ‘Card‘ ‘Note‘ ‘Sharing‘ ‘Picture‘])
def text_reply(msg):
   # 当消息不是由自己发出的时候
   if not msg[‘FromUserName‘] == Name[“Mai“]:
       # 回复给好友
       url = “http://www.tuling123.com/openapi/api?key=09b2c32561ff493087600

评论

共有 条评论