Files
wiki_crawler/nodes/parse_pending_urls.py

22 lines
654 B
Python
Raw Normal View History

2025-12-22 22:08:51 +08:00
def check_status(status_code: float, body: str):
'''
检查状态码和约定的返回值
'''
if status_code != 200:
raise Exception(f"注册任务失败,状态码:{status_code}")
if "code" not in body or body["code"] != 1:
raise Exception(f"注册任务失败,返回值:{body}")
def main(status_code: float, body: str):
try:
check_status(status_code, body)
except Exception as e:
raise e
urls = body["data"]["urls"]
return {
2025-12-22 22:33:18 +08:00
"urls": urls,
2025-12-22 22:50:07 +08:00
"iteration_output": [] # 迭代器运行结果记录,用于传入给迭代器进行记录运行情况
2025-12-22 22:08:51 +08:00
}