From 4661eb0efe78a3ad31cf86ac45354c576ac06f38 Mon Sep 17 00:00:00 2001 From: litlighilit Date: Tue, 24 Jun 2025 22:39:50 +0800 Subject: [PATCH] style: use " over ' --- xha_auto_login.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/xha_auto_login.py b/xha_auto_login.py index 598c424..42bd560 100644 --- a/xha_auto_login.py +++ b/xha_auto_login.py @@ -11,7 +11,7 @@ import subprocess def request_get_text(url, headers={}): req = request.Request(url, headers=headers) with request.urlopen(req) as response: - return response.read().decode('utf-8') + return response.read().decode("utf-8") class LoginStatus(IntEnum): unknown = -maxsize-1 @@ -36,7 +36,7 @@ class Loginer: if not self.interface_def: command = ["ping", "-I", interface] host = "223.5.5.5" - command += ['-c', '1', host] # -n 1 on windows, -c 1 on linux + command += ["-c", "1", host] # -n 1 on windows, -c 1 on linux try: result = subprocess.check_call(command, timeout=2) return result == 0 @@ -89,7 +89,7 @@ class Loginer: j = self.json_from_drnnnn(t) # 检查是否付费 - if j['user_info']['user_state'] == "正常" and j['user_info']['available_flow'] in ("0MB", "无限制"): + if j["user_info"]["user_state"] == "正常" and j["user_info"]["available_flow"] in ("0MB", "无限制"): url = self.urlloadOnlineRecord + u # 获取在线设备 t = request_get_text(url, headers=self.header) @@ -115,14 +115,14 @@ class Loginer: self.log(f"使用接口 {interface} 进行请求") msg += f"接口 {interface}: " - j_msg = j_res['msg'] - if '密码错误' in j_msg: + j_msg = j_res["msg"] + if "密码错误" in j_msg: msg += f"{user} {pwd} 密码错误" result = LoginStatus.bad_pwd - elif '已经在线' in j_msg: + elif "已经在线" in j_msg: msg += "正常在线!" result = LoginStatus.used_online - elif '认证成功' in j_msg: + elif "认证成功" in j_msg: msg += f"使用账号{user}登录成功!" result = LoginStatus.succ self.log(msg)