Reputation: 1
Currently, my code is displaying news from south Africa and also America. How does one only produce results strictly from the UK?
search_term = "flood, fire, storm"
date = datetime.today().strftime('%Y-%m-%d')
search_url = "https://api.bing.microsoft.com/v7.0/news/search"
headers = {"Ocp-Apim-Subscription-Key" : subscription_key}
params = {
"q": search_term,
"cc": "en-GB",
"mkt": "en-GB","textDecorations": True,
"setLang": "en-gb",
"textFormat": "HTML", "sortBy": date
}
response = requests.get(search_url, headers=headers, params=params)
response.raise_for_status()
search_results = json.dumps(response.json())
print(search_results)
Upvotes: 0
Views: 93