weiban-tool/main.py

32 lines
1.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# @Author : Qiuyelin
# @repo : https://github.com/pooneyy/weiban-tool
import os
import Utils
import time
import json
# tenantCode UserId x-token userProjectId
try:
with open("config.json", "r+", encoding='utf8') as file:
usersConfig = json.load(file)
for user in usersConfig:
tenantCode = user['tenantCode']
userId = user['userId']
x_token = user['token']
userProjectId = user['userProjectId']
main = Utils.main(tenantCode, userId, x_token, userProjectId)
main.init()
try:
finishIdList = main.getFinishIdList()
except json.decoder.JSONDecodeError:
print('账户信息错误或已经过期请重新获取。详见https://github.com/pooneyy/weiban-tool')
break
for i in main.getCourse():
main.start(i)
time.sleep(20)
main.finish(finishIdList[i])
os.system("pause")
except FileNotFoundError:
print('未找到 config.json详见https://github.com/pooneyy/weiban-tool')
os.system("pause")