Files
DecomEval/backend/app/collect/remote.py
T

18 lines
556 B
Python

"""从已登录的大数据平台取回表格。"""
from __future__ import annotations
from urllib.parse import urlparse
from app.nqi.client import NqiClient
async def fetch_nqi(client: NqiClient, config: dict) -> tuple[str, bytes]:
address = str(config.get("url") or "").strip()
if not address:
raise ValueError("未配置 NQI 采集地址")
parsed = urlparse(address)
if parsed.scheme not in {"http", "https"}:
raise ValueError("NQI 采集地址需要是 http 或 https")
return await client.fetch_bytes(address)