From 12682411f0a35a5b4dc8844aac7a7f3c8d046862 Mon Sep 17 00:00:00 2001 From: Mufanc <47652878+Mufanc@users.noreply.github.com> Date: Tue, 23 Nov 2021 00:12:17 +0800 Subject: [PATCH] =?UTF-8?q?websockets=20=E6=A8=A1=E5=9D=97=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E9=99=8D=E7=BA=A7=E4=B8=BA=208.1=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=9B=B4=E8=AF=A6=E7=BB=86=E7=9A=84=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- automaton/devtools.py | 2 ++ automaton/spider/spider.py | 7 +++++-- requirements.txt | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/automaton/devtools.py b/automaton/devtools.py index 86af9c6..48f259b 100644 --- a/automaton/devtools.py +++ b/automaton/devtools.py @@ -34,6 +34,8 @@ class Browser(object): })() '''))['result']['value'])['data'] spider_user = configs['user']['username'] + logger.debug(f'spider: {spider_user}') + logger.debug(f'iSmart client: {json.dumps(user_info, indent=4)}') if spider_user != user_info['mobile'] and spider_user != user_info['username']: logger.warning('检测到 iSmart 客户端中登录的账号与配置文件中账号不符!') choice = input('继续使用可能会出现意料之外的问题,是否继续?[y/N]') diff --git a/automaton/spider/spider.py b/automaton/spider/spider.py index 49ae6d9..d1b52c9 100644 --- a/automaton/spider/spider.py +++ b/automaton/spider/spider.py @@ -1,3 +1,4 @@ +import json from hashlib import md5 from random import random @@ -134,8 +135,9 @@ class Spider(httpx.AsyncClient): params={ 'ticket': ticket } - )).json()['data'] - return paper_info + )).json() + logger.debug(f'paper_info: {json.dumps(paper_info, indent=4)}') + return paper_info['data'] async def user_info(self): logger.info('正在获取用户信息...') @@ -168,4 +170,5 @@ class Spider(httpx.AsyncClient): 'bookType': 0 } )).json() + logger.debug(f'book_info: {json.dumps(book_info, indent=4)}') return book_info['data'] diff --git a/requirements.txt b/requirements.txt index e4cd82c..5f94ee5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,5 +3,5 @@ opencv-python~=4.5.3.56 numpy~=1.21.2 httpx~=0.19.0 beautifulsoup4~=4.10.0 -websockets~=10.0 +websockets~=8.1 PyYAML~=5.4.1 \ No newline at end of file