添加工具类

This commit is contained in:
LibraHp_0928 2024-02-13 14:24:46 +08:00
parent 5cff617858
commit fc9f5f1369
2 changed files with 16 additions and 5 deletions

View File

@ -16,14 +16,24 @@ def save_user(cookies):
def read_files_in_folder():
# 获取文件夹下的所有文件
files = os.listdir(user_path)
# 如果文件夹为空
if not files:
return None
# 输出文件列表
print("已保存用户:")
print("登录用户列表:")
for i, file in enumerate(files):
print(f"{i + 1}. {file}")
# 选择文件
choice = int(input("请选择要登陆的用户: "))
while True:
try:
choice = int(input("请选择要登录的用户序号: "))
if 1 <= choice <= len(files):
break
else:
print("无效的选择,请重新输入。")
except ValueError:
print("无效的选择,请重新输入。")
# 读取选择的文件
selected_file = files[choice - 1]

View File

@ -50,8 +50,9 @@ def QR():
def cookie():
if Config.read_files_in_folder():
return eval(Config.read_files_in_folder())
select_user = Config.read_files_in_folder()
if select_user:
return eval(select_user)
# 获取 QQ空间 cookie
qrsig = QR()
ptqrtoken = ptqrToken(qrsig)