Python3.6之给指定用户发送微信消息

大家好,我又回来啦!!!

最近的新研究,用py3给微信指定用户发送消息

#!/usr/bin/python3

# -*- coding: utf-8 -*-

importdatetime

importtime

importrequests

importjson

github_url ="http://192.168.1.70:8080/robot/messageServlet2"

data = json.dumps({'name':'test','phone':139})

url ='http://192.168.1.70:8080/robot/messageServlet2'

# r = requests.post(url, data={'name': 'test', 'phone': 'some test repo'})

while1:

now = datetime.datetime.now()

now_str = now.strftime('%Y/%m/%d %H:%M:%S')[11:]

print('\r{}'.format(now_str),end='')

r = requests.post(url,data={'name':'test','phone':139,'content':'内容'})

print(r.text.data)

time.sleep(1)

print("结束")

亲测可用,内含定时功能

  • 发表于:
  • 原文链接:http://kuaibao.qq.com/s/20180130G0VDB800?refer=cp_1026

扫码关注云+社区