更新 iKuuu/ik_signin.py
增加接口请求的超时时间
This commit is contained in:
parent
8a43d320cf
commit
872f0a5d71
@ -1,9 +1,9 @@
|
|||||||
"""
|
```
|
||||||
任务名称
|
任务名称
|
||||||
name: iKuuu签到
|
name: iKuuu签到
|
||||||
定时规则
|
定时规则
|
||||||
cron: 0 0 8 * * ?
|
cron: 0 0 8 * * ?
|
||||||
"""
|
```
|
||||||
import requests
|
import requests
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
@ -100,7 +100,7 @@ def get_remaining_flow(cookies):
|
|||||||
user_url = f'https://{ikun_host}/user'
|
user_url = f'https://{ikun_host}/user'
|
||||||
try:
|
try:
|
||||||
# 获取用户页面
|
# 获取用户页面
|
||||||
user_page = requests.get(user_url, cookies=cookies, headers={"User-Agent": USER_AGENT}, timeout=15)
|
user_page = requests.get(user_url, cookies=cookies, headers={"User-Agent": USER_AGENT}, timeout=20)
|
||||||
if user_page.status_code != 200:
|
if user_page.status_code != 200:
|
||||||
return "获取流量失败", "状态码: " + str(user_page.status_code)
|
return "获取流量失败", "状态码: " + str(user_page.status_code)
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ def ikuuu_signin(email, password):
|
|||||||
login_url = f'https://{ikun_host}/auth/login'
|
login_url = f'https://{ikun_host}/auth/login'
|
||||||
try:
|
try:
|
||||||
# 登录请求,添加User-Agent
|
# 登录请求,添加User-Agent
|
||||||
login_res = requests.post(login_url, data=params, headers={"User-Agent": USER_AGENT}, timeout=15)
|
login_res = requests.post(login_url, data=params, headers={"User-Agent": USER_AGENT}, timeout=20)
|
||||||
if login_res.status_code != 200:
|
if login_res.status_code != 200:
|
||||||
flow_value, flow_unit = "登录失败", "无法获取"
|
flow_value, flow_unit = "登录失败", "无法获取"
|
||||||
return False, f"登录失败(状态码{login_res.status_code})", flow_value, flow_unit
|
return False, f"登录失败(状态码{login_res.status_code})", flow_value, flow_unit
|
||||||
@ -158,7 +158,7 @@ def ikuuu_signin(email, password):
|
|||||||
flow_value, flow_unit = get_remaining_flow(cookies)
|
flow_value, flow_unit = get_remaining_flow(cookies)
|
||||||
|
|
||||||
# 执行签到,添加User-Agent
|
# 执行签到,添加User-Agent
|
||||||
checkin_res = requests.post(f'https://{ikun_host}/user/checkin', cookies=cookies, headers={"User-Agent": USER_AGENT}, timeout=15)
|
checkin_res = requests.post(f'https://{ikun_host}/user/checkin', cookies=cookies, headers={"User-Agent": USER_AGENT}, timeout=20)
|
||||||
if checkin_res.status_code != 200:
|
if checkin_res.status_code != 200:
|
||||||
return False, f"签到失败(状态码{checkin_res.status_code})", flow_value, flow_unit
|
return False, f"签到失败(状态码{checkin_res.status_code})", flow_value, flow_unit
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user