Skip to content

Commit 631de60

Browse files
authored
Updated endpoint/key
Endpoints are not region-based anymore, but rather custom domain -based. Although regional endpoints will still work. Also, the authentication information is moving to a standard of getting it from environment variables.
1 parent 0d20f1e commit 631de60

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

go/Search/BingWebSearchv7.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import (
33
"fmt"
44
"net/http"
55
"io/ioutil"
6+
"os"
67
"time"
78
"encoding/json"
89
)
@@ -64,8 +65,9 @@ type BingAnswer struct {
6465

6566
// Declare the main function. This is required for all Go programs.
6667
func main() {
67-
const endpoint = "https://api.cognitive.microsoft.com/bing/v7.0/search"
68-
token := "YOUR-ACCESS-KEY"
68+
// Add your Bing Search V7 endpoint and subscription key to your environment variables.
69+
const endpoint = os.Getenv("BING_SEARCH_V7_ENDPOINT")
70+
token := os.Getenv("BING_SEARCH_V7_SUBSCRIPTION_KEY")
6971
searchTerm := "Microsoft Cognitive Services"
7072

7173
// Declare a new GET request.

0 commit comments

Comments
 (0)