"""
Description:时间可以改长一点 一分钟一个
Author:Nod
Date:
Record:
#---------------------------------v1-----------------------------------#
""" from __future__ import unicode_literals
from threading import Timer
from wxpy import *
import requests bot = Bot() # linux执行登陆请调用下面的这句
#bot = Bot(console_qr=2,cache_path="botoo.pkl")
#获取金山词霸每日一句,英文和翻译
def get_news():
url = "http://open.iciba.com/dsapi/"
r = requests.get(url)
content = r.json()['content']
note = r.json()['note']
return content, note def send_news():
try:
contents = get_news() # 你朋友的微信备注,请注意最好你的好友备注只有1个 my_friend = bot.friends().search(u'季学远')[0]
my_friend.send(contents[0])
my_friend.send(contents[1])
my_friend.send(u"Have a good one!")
# 每86400秒(1天),发送1次
t = Timer(86400, send_news)
t.start()
except: # 你的微信名称,不是微信帐号。 my_friend = bot.friends().search('季学远')[0]
my_friend.send(u"今天消息发送失败了") if __name__ == "__main__":
send_news()

pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple requests
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple wxpy

Python下发送定时消息给微信好友的更多相关文章

  1. Python-定时爬取指定城市天气(一)-发送给关心的微信好友

    一.背景 上班的日子总是3点一线,家里,公司和上班的路径,对于一个特别懒得我来说,经常遇到上班路上下雨了,而我却没带伞,多么痛的领悟.最近对python有一种狂热的学习热情,写了4年多的C++代码,对 ...

  2. MQ发送定时消息

    通过延时发送来发送定时消息. RocketMQ只支持固定精度时间的延时消息发送:1s 5s 10s 30s 1m 2m 3m 4m 5m 6m 7m 8m 9m 10m 20m 30m 1h 2h 若 ...

  3. PHP实现发送模板消息到微信公众号

    简述:在这里会具体讲述到如何实现:如何通过后台的代码来实现发送模板消息到已经关注了"心想"公众号的用户. (本人新手,目前实习中,我的所有文档都是在自己开发过程中的记录,有些言语跟 ...

  4. PHP实现发送模板消息(微信公众号版)

    以下为开发步骤: 1.微信公众号为服务号且开通微信认证(其他类型账号不能发送) 2.ip白名单设置你的服务器ip(用于获取access_token) 3.网页授权你的域名(用于获取用户的openid) ...

  5. 使用wxpy来实现自动发送消息统计微信好友信息的功能

    发送消息太频繁会出现禁言消息 1:导入wxpy模块 pip install wxpy pip3 install wxpy #二者选一 调用模块 # 导入模块 from wxpy import * # ...

  6. python爬虫 发送定时气象预报

    python爬取天气情况 下面为示例代码: from urllib.request import urlopen from bs4 import BeautifulSoup from urllib.e ...

  7. Swift - 发送消息(文本,图片,文件等)给微信好友或分享到朋友圈

    通过调用微信提供的API接口,我们可以很方便的在应用中发送消息给微信好友,或者分享到朋友圈.在微信开发平台(https://open.weixin.qq.com)里,提供了详细的说明文档和样例.但由于 ...

  8. 微信小程序中发送模版消息注意事项

    在微信小程序中发送模版消息 参考微信公众平台Api文档地址:https://mp.weixin.qq.com/debug/wxadoc/dev/api/notice.html#模版消息管理 此参考地址 ...

  9. pyqt win32发送QQ消息

    标题应该改为:python+win32发送QQ消息,全程使用python套个pyqt壳. 其实代码来自: http://blog.csdn.net/suzyu12345/article/details ...

随机推荐

  1. linux---文件颜色含义

    下面是linux系统约定不同类型文件默认的颜色: 白色:表示普通文件 蓝色:表示目录 绿色:表示可执行文件 红色:表示压缩文件 浅蓝色:链接文件 红色闪烁:表示链接的文件有问题 黄色:表示设备文件 灰 ...

  2. 在java中(==)的用法

  3. !!!!---linux常见问题和解决方案--我的

    -------------------------------------------------------------磁盘 ---------------------------文件.目录1.删除 ...

  4. day 50 Java Script 学习

    前端基础之JavaScript   JavaScript概述 JavaScript的历史 1992年Nombas开发出C-minus-minus(C--)的嵌入式脚本语言(最初绑定在CEnvi软件中) ...

  5. Stream Processing 101: From SQL to Streaming SQL in 10 Minutes

    转自:https://wso2.com/library/articles/2018/02/stream-processing-101-from-sql-to-streaming-sql-in-ten- ...

  6. loki grafana 团队开源的,类似Prometheus 的log 系统

    Prometheus 主要面向的是metrics,但是loki 是log,这样加上grafana 强大的可视化以及alert能力, 我们可以做好多事情,loki 的设计来源于Prometheus. 组 ...

  7. 使用tailor 轻松方便的集成web 框架react&&vue

    tailor 是一款很方便的layout 服务,类似facebook 的bigpipe,我们可以使用此工具 方便的集成各类web 框架,实现micro-fronteds 开发 参考demo https ...

  8. sql-索引的作用

    (一)深入浅出理解索引结构 何时使用聚集索引/非聚集索引 结合实际,谈索引使用的误区 其他书上没有的索引使用经验总结 其他注意事项 (二)改善SQL语句 (三)实现小数据量和海量数据的通用分页显示存储 ...

  9. node start - hello world http server

    Write a file t1.js 'use strict'; const express = require('express'); // Constants const PORT = 8080; ...

  10. removing-guest-session-at-login-in-ubuntu-14-04

    http://askubuntu.com/questions/451526/removing-guest-session-at-login-in-ubuntu-14-04