chore: auto release commit (2026-07-03 12:09:55)
All checks were successful
技能自动化发布 / release (push) Successful in 5s
All checks were successful
技能自动化发布 / release (push) Successful in 5s
This commit is contained in:
@@ -1,6 +1,53 @@
|
||||
"""技能标识、版本与平台公共库约束(复制后请修改 slug/version/logger)。"""
|
||||
"""技能标识、版本与 Amazon 仿真平台 URL 常量。"""
|
||||
|
||||
SKILL_SLUG = "your-skill-slug"
|
||||
SKILL_VERSION = "1.0.32"
|
||||
LOG_LOGGER_NAME = "openclaw.skill.your_skill_slug"
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
|
||||
SKILL_SLUG = "download-settlement-report-amazon"
|
||||
SKILL_VERSION = "1.0.0"
|
||||
LOG_LOGGER_NAME = "openclaw.skill.download_settlement_report_amazon"
|
||||
PLATFORM_KIT_MIN_VERSION = "1.0.17"
|
||||
|
||||
TARGET_PLATFORM = "amazon_sim"
|
||||
LEASE_HOLDER = "download-settlement-report-amazon"
|
||||
LEASE_TTL_SEC = "600"
|
||||
|
||||
DEFAULT_DATE_FROM = "2025-12-01"
|
||||
DEFAULT_DATE_TO = "2025-12-31"
|
||||
|
||||
DEFAULT_TIMEOUT_MS = 15_000
|
||||
LOGIN_NAVIGATE_TIMEOUT_MS = 30_000
|
||||
REPORTS_NAVIGATE_TIMEOUT_MS = 60_000
|
||||
JOB_POLL_TIMEOUT_SEC = 60
|
||||
JOB_POLL_INTERVAL_SEC = 2
|
||||
|
||||
ENV_AMAZON_SIM_BASE_URL = "AMAZON_SIM_BASE_URL"
|
||||
ENV_AMAZON_SIM_REPORTS_URL = "AMAZON_SIM_REPORTS_URL"
|
||||
ENV_AMAZON_SIM_LOGIN_URL = "AMAZON_SIM_LOGIN_URL"
|
||||
|
||||
DEFAULT_AMAZON_SIM_BASE_URL = "https://sandbox.jc2009.com/industries/ecommerce/amazon"
|
||||
DEFAULT_AMAZON_SIM_REPORTS_URL = (
|
||||
"https://sandbox.jc2009.com/industries/ecommerce/amazon/seller/reports"
|
||||
)
|
||||
DEFAULT_AMAZON_SIM_LOGIN_URL = (
|
||||
"https://sandbox.jc2009.com/industries/ecommerce/amazon/login"
|
||||
)
|
||||
|
||||
|
||||
def resolve_amazon_sim_base_url() -> str:
|
||||
return (
|
||||
(os.getenv(ENV_AMAZON_SIM_BASE_URL) or DEFAULT_AMAZON_SIM_BASE_URL).strip().rstrip("/")
|
||||
)
|
||||
|
||||
|
||||
def resolve_amazon_sim_reports_url() -> str:
|
||||
return (
|
||||
(os.getenv(ENV_AMAZON_SIM_REPORTS_URL) or DEFAULT_AMAZON_SIM_REPORTS_URL).strip()
|
||||
)
|
||||
|
||||
|
||||
def resolve_amazon_sim_login_url() -> str:
|
||||
return (
|
||||
(os.getenv(ENV_AMAZON_SIM_LOGIN_URL) or DEFAULT_AMAZON_SIM_LOGIN_URL).strip()
|
||||
)
|
||||
|
||||
34
scripts/util/logging.py
Normal file
34
scripts/util/logging.py
Normal file
@@ -0,0 +1,34 @@
|
||||
"""结构化日志与敏感字段脱敏。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import re
|
||||
from typing import Any
|
||||
|
||||
from util.constants import LOG_LOGGER_NAME
|
||||
|
||||
|
||||
def get_logger(name: str | None = None) -> logging.Logger:
|
||||
return logging.getLogger(name or LOG_LOGGER_NAME)
|
||||
|
||||
|
||||
def mask_text(value: str, *, keep_start: int = 2, keep_end: int = 2) -> str:
|
||||
s = (value or "").strip()
|
||||
if len(s) >= 11 and s.isdigit():
|
||||
return s[:3] + "****" + s[-4:]
|
||||
if len(s) > keep_start + keep_end:
|
||||
return s[:keep_start] + "****" + s[-keep_end:]
|
||||
return "****"
|
||||
|
||||
|
||||
def safe_log_value(value: Any) -> str:
|
||||
if value is None:
|
||||
return ""
|
||||
text = str(value)
|
||||
if re.fullmatch(r"\d{7,}", text):
|
||||
return mask_text(text)
|
||||
if "@" in text and len(text) > 6:
|
||||
local, _, domain = text.partition("@")
|
||||
return f"{mask_text(local, keep_start=1, keep_end=1)}@{domain}"
|
||||
return text
|
||||
Reference in New Issue
Block a user