Files
opencatd-open/pkg/search/bing_test.go
2025-04-16 18:01:27 +08:00

31 lines
747 B
Go

/*
文档 https://www.microsoft.com/en-us/bing/apis/bing-web-search-api
价格 https://www.microsoft.com/en-us/bing/apis/pricing
curl -H "Ocp-Apim-Subscription-Key: <yourkeygoeshere>" https://api.bing.microsoft.com/v7.0/search?q=今天上海天气怎么样
curl -H "Ocp-Apim-Subscription-Key: 6fc7c97ebed54f75a5e383ee2272c917" https://api.bing.microsoft.com/v7.0/search?q=今天上海天气怎么样
*/
package search
import (
"testing"
)
func TestBingSearch(t *testing.T) {
var searchParams = SearchParams{
Query: "上海明天天气怎么样",
Num: 3,
}
t.Run("BingSearch", func(t *testing.T) {
got, err := BingSearch(searchParams)
if err != nil {
t.Errorf("BingSearch() error = %v", err)
return
}
t.Log(got)
})
}