Ziroom--Monitor

[] [centos_shell]
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 28 15:52:59 2018
@author: root
"""
import requests
import itchat
import time
import datetime
#itchat.auto_login()
itchat.auto_login(hotReload=True)
itchat.auto_login(enableCmdQR=-1)
#from urllib import request
url = "http://phoenix.ziroom.com/v7/room/detail.json?house_id=62947781&city_code=110000&id=61544148"
headers = {
'accept': 'application/json;version=3',
'Host': 'phoenix.ziroom.com',
'Referer': 'https://hd.ziroom.com/2018/haiyan/index.html?citycode=110000',
# 'token': 'd76a826e-bfb4-4421-902e-132418ebedfa',
'User-Agent': 'okhttp/3.10.0',
}
def get_page(url):
try:
response = requests.get(url, headers=headers)
if response.status_code == 200:
return response.json()
except requests.ConnectionError as e:
print('Error', e.args)



if __name__ == '__main__':
n = 0
while (1):
n = n+1
json_dict = get_page(url)
# print(json_dict)
statuss = json_dict['data']['status']
nowTime=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
print("status:",statuss)
if statuss == 'zxpzz':
print("NOt Time!!!")
itchat.send('<'+str(n)+'>'+'骚年~装修配置中>>>'+nowTime, toUserName='filehelper')
time.sleep(360)
else:
print("GOGOGOOGOOO!!!!!")
itchat.send('<'+str(n)+'>'+'0o0o0o0~可以预定了--gogogogo>>>'+nowTime, toUserName='filehelper')
time.sleep(120)
文章目录
|