MCPcopy Create free account
hub / github.com/Tron521/codex-console-temp / __init__

Method __init__

src/core/http_client.py:237–267  ·  view source on GitHub ↗

初始化 OpenAI HTTP 客户端 Args: proxy_url: 代理 URL config: 请求配置

(
        self,
        proxy_url: Optional[str] = None,
        config: Optional[RequestConfig] = None
    )

Source from the content-addressed store, hash-verified

235 """
236
237 def __init__(
238 self,
239 proxy_url: Optional[str] = None,
240 config: Optional[RequestConfig] = None
241 ):
242 """
243 初始化 OpenAI HTTP 客户端
244
245 Args:
246 proxy_url: 代理 URL
247 config: 请求配置
248 """
249 super().__init__(proxy_url, config)
250
251 # OpenAI 特定的默认配置
252 if config is None:
253 self.config.timeout = 30
254 self.config.max_retries = 3
255
256 # 默认请求头
257 self.default_headers = {
258 "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
259 "(KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
260 "Accept": "application/json",
261 "Accept-Language": "en-US,en;q=0.9",
262 "Accept-Encoding": "gzip, deflate, br",
263 "Connection": "keep-alive",
264 "Sec-Fetch-Dest": "empty",
265 "Sec-Fetch-Mode": "cors",
266 "Sec-Fetch-Site": "same-site",
267 }
268
269 def check_ip_location(self) -> Tuple[bool, Optional[str]]:
270 """

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected