首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

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
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

扫码

添加站长 进交流群

领取专属 10元无门槛券

私享最新 技术干货

扫码加入开发者社群
领券