feat:图表交互
This commit is contained in:
@@ -20,6 +20,7 @@ from urllib.parse import urljoin
|
||||
import httpx
|
||||
|
||||
from app.core.exceptions import BizException
|
||||
from app.schemas.screen import fill_template
|
||||
|
||||
TIMEOUT = 5.0
|
||||
MAX_BYTES = 2 * 1024 * 1024
|
||||
@@ -113,6 +114,12 @@ def _clean_headers(headers: dict[str, Any] | None) -> dict[str, str]:
|
||||
return cleaned
|
||||
|
||||
|
||||
def fill_params(params: dict[str, Any], variables: dict[str, Any]) -> dict[str, Any]:
|
||||
"""数据源 params 的值里的 {{变量ID}} 换成变量的值,规则同前端 fillTemplate;只代入 params,
|
||||
地址和请求头不代入:线上取数是匿名接口,代入地址就成了开放代理"""
|
||||
return {key: fill_template(value, variables) for key, value in params.items()}
|
||||
|
||||
|
||||
def _query_value(value: Any) -> Any:
|
||||
return value if isinstance(value, (str, int, float, bool)) else json.dumps(value)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user