checkPythonAiohttp 检查 Python 和 aiohttp 是否可用
()
| 225 | |
| 226 | // checkPythonAiohttp 检查 Python 和 aiohttp 是否可用 |
| 227 | func checkPythonAiohttp() bool { |
| 228 | runtime := NewPythonRuntime(nil) |
| 229 | if !runtime.IsAvailable() { |
| 230 | return false |
| 231 | } |
| 232 | |
| 233 | // 检查 aiohttp 是否安装 |
| 234 | code := "import aiohttp" |
| 235 | ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) |
| 236 | defer cancel() |
| 237 | |
| 238 | result, err := runtime.Execute(ctx, code, map[string]any{}) |
| 239 | return err == nil && result.Success |
| 240 | } |
no test coverage detected