Conditions | 4 |
Total Lines | 27 |
Code Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | # -*- coding: utf-8 -*- |
||
18 | @staticmethod |
||
19 | def sign(cookie): |
||
20 | session = requests.session() |
||
21 | res = "" |
||
22 | headers = { |
||
23 | "Cookie": cookie, |
||
24 | "ContentType": "text/html;charset=gbk", |
||
25 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) " |
||
26 | "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36", |
||
27 | } |
||
28 | session.put( |
||
29 | "https://www.52pojie.cn/home.php?mod=task&do=apply&id=2", headers=headers |
||
30 | ) |
||
31 | response = session.put( |
||
32 | "https://www.52pojie.cn/home.php?mod=task&do=draw&id=2", headers=headers |
||
33 | ) |
||
34 | soup = BeautifulSoup(response.text, "html.parser") |
||
35 | msg = soup.find("div", id="messagetext").find("p").text |
||
36 | if "您需要先登录才能继续本操作" in msg: |
||
37 | res += "Cookie 失效" |
||
38 | elif "恭喜" in msg: |
||
39 | res += "签到成功" |
||
40 | elif "不是进行中的任务" in msg: |
||
41 | res += "不是进行中的任务" |
||
42 | else: |
||
43 | res += "签到失败" |
||
44 | return res |
||
45 | |||
61 |