sansan0/TrendRadar · error · ImportError

远程存储后端需要安装 boto3: pip install boto3

Error message

远程存储后端需要安装 boto3: pip install boto3

What it means

Error "远程存储后端需要安装 boto3: pip install boto3" thrown in sansan0/TrendRadar.

Source

Thrown at trendradar/storage/remote.py:81

        temp_dir: Optional[str] = None,
        timezone: str = DEFAULT_TIMEZONE,
    ):
        """
        初始化远程存储后端

        Args:
            bucket_name: 存储桶名称
            access_key_id: 访问密钥 ID
            secret_access_key: 访问密钥
            endpoint_url: 服务端点 URL
            region: 区域(可选,部分服务商需要)
            enable_txt: 是否启用 TXT 快照(默认关闭)
            enable_html: 是否启用 HTML 报告
            temp_dir: 临时目录路径(默认使用系统临时目录)
            timezone: 时区配置
        """
        if not HAS_BOTO3:
            raise ImportError("远程存储后端需要安装 boto3: pip install boto3")

        self.bucket_name = bucket_name
        self.endpoint_url = endpoint_url
        self.region = region
        self.enable_txt = enable_txt
        self.enable_html = enable_html
        self.timezone = timezone

        # 创建临时目录
        self.temp_dir = Path(temp_dir) if temp_dir else Path(tempfile.mkdtemp(prefix="trendradar_"))
        self.temp_dir.mkdir(parents=True, exist_ok=True)

        # 初始化 S3 客户端
        # 使用 virtual-hosted style addressing(主流)
        # 根据服务商选择签名版本:
        # - 腾讯云 COS 和 阿里云 OSS 使用 SigV2 以避免 chunked encoding 问题
        # - 其他服务商(AWS S3、Cloudflare R2、MinIO 等)默认使用 SigV4
        use_sigv2 = "myqcloud.com" in endpoint_url.lower() or "aliyuncs.com" in endpoint_url.lower()

View on GitHub (pinned to 8ee26026ba)

Solutions

  1. 执行 pip install boto3 安装远程存储依赖
  2. 若不需要远程存储,改用本地存储后端

Example fix

pip install boto3

When it happens

Trigger: Thrown at trendradar/storage/remote.py:81 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sansan0/TrendRadar@8ee26026ba (2026-08-15). Data as JSON: /api/errors/e1ca2070d39f5e41. Report an issue: GitHub.