main.go 590 B

12345678910111213141516171819202122232425
  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. Dependencies: []types.Dependency{},
  18. })
  19. fmt.Println(resp.Data)
  20. }