From 002958475e9d5d7223fd25d170bdf6d4b65599ce Mon Sep 17 00:00:00 2001 From: ngfchl Date: Fri, 23 Sep 2022 14:58:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9F=A5=E7=9C=8B=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E5=90=8E=E6=9B=B4=E6=96=B0=E6=B6=88=E6=81=AF=E6=95=B0?= =?UTF-8?q?=E9=87=8F=E4=B8=8D=E4=BC=9A=E5=8F=98=E5=8C=96=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pt_site/UtilityTool.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pt_site/UtilityTool.py b/pt_site/UtilityTool.py index 8bf2cde..a888779 100644 --- a/pt_site/UtilityTool.py +++ b/pt_site/UtilityTool.py @@ -161,6 +161,7 @@ class PtSpider: url: str, method: str = 'get', data: dict = None, + params: dict = None, timeout: int = 20, delay: int = 15, headers: dict = {}, @@ -179,7 +180,8 @@ class PtSpider: cookies=self.cookies2dict(my_site.cookie), data=data, timeout=timeout, - proxies=proxies + proxies=proxies, + params=params, ) return scraper.get( url=url, @@ -188,6 +190,7 @@ class PtSpider: data=data, timeout=timeout, proxies=proxies, + params=params, ) def ocr_captcha(self, img_url): @@ -383,7 +386,7 @@ class PtSpider: print(submit_name) print(submit_value) headers = { - "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" + "mimeType": "application/x-www-form-urlencoded; charset=UTF-8" } params = [] for name, value in zip(submit_name, submit_value): @@ -404,10 +407,11 @@ class PtSpider: print(data) response = self.send_request( my_site, - url=site.url + '?action=show', + url=site.url + '?action=show' + param, method=site.sign_in_method, headers=headers, - data=data + params=data, + data=data, ) print(response.content.decode('utf8')) return CommonResponse.success(data=response) @@ -1218,8 +1222,8 @@ class PtSpider: notice_count = re.sub(u"([^\u0030-\u0039])", "", notice_str) mail_count = int(mail_count) if mail_count else 0 notice_count = int(notice_count) if notice_count else 0 + my_site.mail = mail_count + notice_count if mail_count + notice_count > 0: - my_site.mail = mail_count + notice_count template = '### {} 有{}条新短消息,请注意及时查收!' # 测试发送网站消息原内容 self.send_text(template.format(site.name, mail_count + notice_count) + mail_str + notice_str)