Commit 17d45453 authored by TesterYao's avatar TesterYao

1

parent 089697a4
from time import sleep
import requests
from log import LOG
class PG:
def __init__(self):
self.host = 'https://ssp-manager.tuia.cn'
# 盘古获取待巡查列表接口
self.valid_list_url = '/wchatDomain/wechatScan/openIdAddress?keyStr=wx.openid.redirect.host'
# 盘古上报被封域名列表,微信扫码巡查使用
self.block_list_url = 'https://ssp-manager.tuia.cn/wchatDomain/wechatScan/sendDingDing'
self.session = requests.session()
def get_valid_list(self):
LOG.info('开始获取盘古巡查列表')
r = self.session.get(url=self.host + self.valid_list_url)
if r.status_code == 200 and r.json().get('desc') == '成功':
valid_list = [r.json().get('data')]
if valid_list:
LOG.info('获取盘古巡查列表结果:' + str(valid_list))
return valid_list
else:
LOG.error('获取盘古巡查列表异常,repose:' + r.text)
def post_block_list(self, b_url):
LOG.info('盘古上报被封域名:'+b_url)
data = {
'domain':b_url,
'type':'1'
}
r = self.session.post(url=self.block_list_url,json=data)
print(r.text)
if r.status_code == 200 and r.json().get('desc') == "成功":
LOG.info('上报成功:'+ r.text)
else:
LOG.error('上报失败,1.5S后重新上报:' + r.text)
...@@ -4,6 +4,7 @@ from poco.drivers.ios import iosPoco ...@@ -4,6 +4,7 @@ from poco.drivers.ios import iosPoco
from dingMessage import send_messages from dingMessage import send_messages
from log import LOG from log import LOG
from manager import Zk from manager import Zk
from pangu import PG
from ssp import SSP from ssp import SSP
...@@ -83,7 +84,7 @@ def re_wx(): ...@@ -83,7 +84,7 @@ def re_wx():
if __name__ == '__main__': if __name__ == '__main__':
ssp = SSP() ssp = SSP()
# zk = Zk() pangu = PG()
LOG.info('开始连接设备') LOG.info('开始连接设备')
device = connect_device('ios:///http://127.0.0.1:8100') device = connect_device('ios:///http://127.0.0.1:8100')
LOG.info('连接成功') LOG.info('连接成功')
...@@ -93,7 +94,7 @@ if __name__ == '__main__': ...@@ -93,7 +94,7 @@ if __name__ == '__main__':
check_ex() check_ex()
check_wx() check_wx()
scan() scan()
# runner(zk) runner(pangu)
runner(ssp) runner(ssp)
except Exception as e: except Exception as e:
print(e) print(e)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment