I'm having trouble getting custom search (CS) to work (previously been using Google's CS with no problem).
What I did (following the documentation which generally is excellent on Azure):
- created Bing CS resource and got key (2 provided)
- created Bing instance with a few domains my search aims to cover, published, copied custom config ID
- went back to the CS resource page and copied the sample code (for Python) as below.
- Ran this code in a local Jupyter notebook, using the subscription key and custom cofig ID above.
I get error 404 'resource not found', and haven't been able to figure out what needs to change in the url string...
Any help much appreciated!!
/******************************************************************************/
PYTHON CODE
import json
import os
from pprint import pprint
import requests
subscriptionKey = 'BING_CUSTOM_SEARCH_SUBSCRIPTION_KEY'
endpoint = https://api.bing.microsoft.com # as specified for me on CS resource page
customConfigId = "BING_CUSTOM_CONFIG"
searchTerm = "microsoft"
url = endpoint + "/bingcustomsearch/v7.0/search?q=" + searchTerm + "&customconfig=" + customConfigId
r = requests.get(url, headers={'Ocp-Apim-Subscription-Key': subscriptionKey})
pprint(json.loads(r.text))