获取 API 请求头
(self)
| 79 | self._cached_config: Optional[Dict[str, Any]] = None |
| 80 | |
| 81 | def _get_headers(self) -> Dict[str, str]: |
| 82 | """获取 API 请求头""" |
| 83 | headers = { |
| 84 | "Accept": "application/json", |
| 85 | "Content-Type": "application/json", |
| 86 | } |
| 87 | |
| 88 | # 添加 API 密钥 |
| 89 | api_key_header = self.config.get("api_key_header", "X-API-Key") |
| 90 | headers[api_key_header] = self.config["api_key"] |
| 91 | |
| 92 | return headers |
| 93 | |
| 94 | def _make_request(self, method: str, endpoint: str, **kwargs) -> Dict[str, Any]: |
| 95 | """ |