-
Notifications
You must be signed in to change notification settings - Fork 0
/
toichat.py
68 lines (51 loc) · 1.69 KB
/
toichat.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: chenshy
# @Time : 2018/3/9 15:59
import itchat, time
import requests
from jieping import capture
import datetime
import sched
itchat.auto_login(hotReload=True)
# 发送给公众号 success
# user = itchat.search_friends(name=u'LittleCoder机器人')[0]
# print user
# user.send('greeting, littlecoder!')
# 发送给群聊 succes
# mpsList=itchat.get_chatrooms(update=True)[1:]
# print mpsList
# # itchat.run()
# total=0
# for it in mpsList:
# print(it['NickName'])
# total=total+1
#
# 群聊只会显示最近活跃的项
# room = itchat.search_chatrooms(name=u'19号楼1603')[0]
# print room
# room.send(u'greeting, 明!')
# itchat.dump_login_status()
# 发送给自己 success
# print itchat.search_friends()
# itchat.send('Hello2!')
# 文件传输助手 success
# itchat.send('Hello3!', toUserName='filehelper')
url = 'http:/xxxxx'
a = requests.get(url)
capture(url, save_fn='test1.png')
def sendIcart():
if a.status_code == 200:
mpsList = itchat.get_chatrooms(update=True)[1:]
room = itchat.search_chatrooms(name=u'楼603')[0]
# room = itchat.search_friends()
print room
room.send("@img@%s" % 'test1.png')
utext = unicode("%s月%s日%s点%s分%s秒" % (
datetime.datetime.now().month, datetime.datetime.now().day, datetime.datetime.now().hour,
datetime.datetime.now().minute, datetime.datetime.now().second) + '网站无异常', "utf8")
room.send(utext)
schedule = sched.scheduler(time.time, time.sleep)
for i in range(13):
schedule.enter(900 * i, 0, sendIcart, ())
schedule.run()