Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bing Search v7 example
import requests, json
key = "xxxxx" # Paste your API key here
url = "https://api.bing.microsoft.com/v7.0/search"
search_term = "Azure Cognitive Services"
headers = {"Ocp-Apim-Subscription-Key" : key}
params = {"q": search_term, "textDecorations": True, "textFormat": "HTML"}
response = requests.get(url, headers=headers, params=params)
print(json.dumps(response.json(), indent=2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment