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

Method check_proxy

src/core/http_client.py:199–216  ·  view source on GitHub ↗

检查代理是否可用 Args: test_url: 测试 URL Returns: bool: 代理是否可用

(self, test_url: str = "https://httpbin.org/ip")

Source from the content-addressed store, hash-verified

197 raise HTTPClientError(f"下载文件失败: {url} - {e}")
198
199 def check_proxy(self, test_url: str = "https://httpbin.org/ip") -> bool:
200 """
201 检查代理是否可用
202
203 Args:
204 test_url: 测试 URL
205
206 Returns:
207 bool: 代理是否可用
208 """
209 if not self.proxy_url:
210 return False
211
212 try:
213 response = self.get(test_url, timeout=10)
214 return response.status_code == 200
215 except Exception:
216 return False
217
218 def close(self):
219 """关闭会话"""

Callers

nothing calls this directly

Calls 1

getMethod · 0.95

Tested by

no test coverage detected