Merge branch 'Womsxd:master' into master
This commit is contained in:
commit
1038f5fb9b
16
account.py
16
account.py
@ -5,21 +5,13 @@ from loghelper import log
|
|||||||
from error import CookieError
|
from error import CookieError
|
||||||
|
|
||||||
|
|
||||||
def game_id2name(game_id: str) -> str:
|
|
||||||
try:
|
|
||||||
return setting.game_id2name[game_id]
|
|
||||||
except NameError:
|
|
||||||
return game_id
|
|
||||||
|
|
||||||
|
|
||||||
def stop_module(game_id: str) -> None:
|
def stop_module(game_id: str) -> None:
|
||||||
if game_id == "bh2_cn":
|
if game_id == "bh2_cn":
|
||||||
config.config["games"]["cn"]["hokai2"]["auto_checkin"] = False
|
config.config["games"]["cn"]["hokai2"]["auto_checkin"] = False
|
||||||
elif game_id == "bh3_cn":
|
elif game_id == "bh3_cn":
|
||||||
config.config["games"]["cn"]["honkai3rd"]["auto_checkin"] = False
|
config.config["games"]["cn"]["honkai3rd"]["auto_checkin"] = False
|
||||||
elif game_id == "nxx_cn":
|
elif game_id == "nxx_cn":
|
||||||
# 未定好像没米游社签到
|
config.config["games"]["cn"]["tears_of_themis"]["auto_checkin"] = False
|
||||||
pass
|
|
||||||
elif game_id == "hk4e_cn":
|
elif game_id == "hk4e_cn":
|
||||||
config.config["games"]["cn"]["genshin"]["auto_checkin"] = False
|
config.config["games"]["cn"]["genshin"]["auto_checkin"] = False
|
||||||
else:
|
else:
|
||||||
@ -28,15 +20,15 @@ def stop_module(game_id: str) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def get_account_list(game_id: str, headers: dict) -> list:
|
def get_account_list(game_id: str, headers: dict) -> list:
|
||||||
log.info(f"正在获取米哈游账号绑定的{game_id2name(game_id)}账号列表...")
|
log.info(f"正在获取米哈游账号绑定的{setting.game_id2name.get(game_id,game_id)}账号列表...")
|
||||||
temp_list = []
|
temp_list = []
|
||||||
req = http.get(setting.account_Info_url + game_id, headers=headers)
|
req = http.get(setting.account_Info_url + game_id, headers=headers)
|
||||||
data = req.json()
|
data = req.json()
|
||||||
if data["retcode"] != 0:
|
if data["retcode"] != 0:
|
||||||
log.warning(f"获取{game_id2name(game_id)}账号列表失败!")
|
log.warning(f"获取{setting.game_id2name.get(game_id,game_id)}账号列表失败!")
|
||||||
stop_module(game_id)
|
stop_module(game_id)
|
||||||
raise CookieError("BBS Cookie Error")
|
raise CookieError("BBS Cookie Error")
|
||||||
for i in data["data"]["list"]:
|
for i in data["data"]["list"]:
|
||||||
temp_list.append([i["nickname"], i["game_uid"], i["region"]])
|
temp_list.append([i["nickname"], i["game_uid"], i["region"]])
|
||||||
log.info(f"已获取到{len(temp_list)}个{game_id2name(game_id)}账号信息")
|
log.info(f"已获取到{len(temp_list)}个{setting.game_id2name.get(game_id,game_id)}账号信息")
|
||||||
return temp_list
|
return temp_list
|
||||||
|
@ -2,7 +2,7 @@ try:
|
|||||||
# 优先使用httpx,在httpx无法使用的环境下使用requests
|
# 优先使用httpx,在httpx无法使用的环境下使用requests
|
||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
http = httpx.Client(timeout=10, transport=httpx.HTTPTransport(retries=5))
|
http = httpx.Client(timeout=20, transport=httpx.HTTPTransport(retries=10))
|
||||||
# 当openssl版本小于1.0.2的时候直接进行一个空请求让httpx报错
|
# 当openssl版本小于1.0.2的时候直接进行一个空请求让httpx报错
|
||||||
import tools
|
import tools
|
||||||
|
|
||||||
@ -13,5 +13,5 @@ except (TypeError, ModuleNotFoundError):
|
|||||||
from requests.adapters import HTTPAdapter
|
from requests.adapters import HTTPAdapter
|
||||||
|
|
||||||
http = requests.Session()
|
http = requests.Session()
|
||||||
http.mount('http://', HTTPAdapter(max_retries=5))
|
http.mount('http://', HTTPAdapter(max_retries=10))
|
||||||
http.mount('https://', HTTPAdapter(max_retries=5))
|
http.mount('https://', HTTPAdapter(max_retries=10))
|
||||||
|
@ -98,6 +98,12 @@ honkai3rd_Act_id = "ea20211026151532"
|
|||||||
honkai3rd_Is_signurl = web_Api + "/common/eutheniav2/index?act_id={}®ion={}&uid={}"
|
honkai3rd_Is_signurl = web_Api + "/common/eutheniav2/index?act_id={}®ion={}&uid={}"
|
||||||
honkai3rd_SignUrl = web_Api + "/common/eutheniav2/sign"
|
honkai3rd_SignUrl = web_Api + "/common/eutheniav2/sign"
|
||||||
|
|
||||||
|
# 未定事件簿自动签到相关设置
|
||||||
|
tearsofthemis_Act_id = "e202202251749321"
|
||||||
|
tearsofthemis_checkin_rewards = f'{web_Api}/event/luna/home?lang=zh-cn&act_id={tearsofthemis_Act_id}'
|
||||||
|
tearsofthemis_Is_signurl = honkai2_Is_signurl
|
||||||
|
tearsofthemis_Sign_url = honkai2_Sign_url # 和二崩完全一致
|
||||||
|
|
||||||
# 原神自动签到相关的设置
|
# 原神自动签到相关的设置
|
||||||
genshin_Act_id = "e202009291139501"
|
genshin_Act_id = "e202009291139501"
|
||||||
genshin_checkin_rewards = f'{web_Api}/event/bbs_sign_reward/home?act_id={genshin_Act_id}'
|
genshin_checkin_rewards = f'{web_Api}/event/bbs_sign_reward/home?act_id={genshin_Act_id}'
|
||||||
|
3
tearsofthemis.py
Normal file
3
tearsofthemis.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
class Tears_of_themis:
|
||||||
|
def __init__(self) -> None:
|
||||||
|
pass
|
Loading…
Reference in New Issue
Block a user