main.go 550 B

123456789101112131415161718192021222324
  1. package main
  2. import (
  3. "fmt"
  4. "github.com/langgenius/dify-sandbox/internal/core/runner/python"
  5. "github.com/langgenius/dify-sandbox/internal/core/runner/types"
  6. "github.com/langgenius/dify-sandbox/internal/service"
  7. "github.com/langgenius/dify-sandbox/internal/static"
  8. )
  9. func main() {
  10. static.InitConfig("conf/config.yaml")
  11. python.PreparePythonDependenciesEnv()
  12. resp := service.RunPython3Code(`import httpx
  13. print(httpx.get("https://www.bilibili.com").text)`,
  14. ``,
  15. &types.RunnerOptions{
  16. EnableNetwork: true,
  17. })
  18. fmt.Println(resp.Data)
  19. }