qnloft-spider/junit/pt_operation_junit.py

54 lines
1.2 KiB
Python

import asyncio
import toml
from fsspec.asyn import loop
from PT.pt_get_data import PtGetData
from PT.pt_operation import PtOperation
pt_opt = PtOperation()
def get_section_name_by_name(name):
with open('../PT/pt_config.toml', 'r', encoding='utf-8') as file:
config_data = toml.load(file)
# 迭代每个 section
for section_name, section_data in config_data.items():
print(f"Processing section: {section_name} --- {section_data.get('url')}")
if name == section_name:
return True, section_name, section_data
async def attendances_junit(name):
"""
PT签到测试
:param name:
:return:
"""
flag, section_name, section_data = get_section_name_by_name(name)
if flag:
await pt_opt.attendances(section_data)
async def signup_junit(name):
"""
PT开注测试
:param name:
:return:
"""
flag, section_name, section_data = get_section_name_by_name(name)
if flag:
await PtOperation().signup(section_data)
def get_pt_data_junit(name):
flag, section_name, section_data = get_section_name_by_name(name)
if flag:
PtGetData().get_data(section_name, section_data)
# asyncio.run(attendances_junit("PTVicomo 象站"))
asyncio.run(signup_junit("Audiences 观众/奥迪"))
# get_pt_data_junit("pttime")