python特定时间发送消息到微信公众号

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = 'James'
# 导入模块
from wxpy import *
import time, datetime
# 初始化机器人,扫码登陆
bot = Bot(cache_path='shuangkai.pkl')

# 搜索名称含有 "游否" 的男性深圳好友
my_friend = bot.friends().search('ruby')[0]
# 发送文本给好友
my_friend.send('Hello WeChat!')
# 发送图片
# my_friend.send_image('my.jpg')



aoti = bot.mps().search('海峡奥体中心')[0]


startTime = datetime.datetime(2019, 4, 26, 12, 0, 0)
print('Program not starting yet...')
while datetime.datetime.now() < startTime:
time.sleep(0.1)
print('Program now starts on %s' % datetime.datetime.now())
print('Executing...')
aoti.send('我爱海峡奥体中心
my_friend.send('已经发送奥体信息!')

embed()

posted on 2019-04-26 10:52  katago  阅读(783)  评论(0编辑  收藏  举报