Skip to content

Commit

Permalink
Fix WebSearch sample
Browse files Browse the repository at this point in the history
  • Loading branch information
lmazuel committed Jan 9, 2018
1 parent 9273119 commit 43cd111
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions samples/search/web_search_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,15 @@ def web_search_with_response_filter(subscription_key):
client = WebSearchAPI(CognitiveServicesCredentials(subscription_key))

try:
web_data = client.web.search(query="Microsoft", response_filter=["news"])
print("Searched for Query# \" Microsoft \" with response filters \"news\"")
web_data = client.web.search(query="Microsoft", response_filter=["News"])
print("Searched for Query# \" Microsoft \" with response filters \"News\"")

if web_data.web_pages.value:
# News attribute since I filtered "News"
if web_data.news.value:

print("Webpage Results#{}".format(len(web_data.web_pages.value)))
print("Webpage Results#{}".format(len(web_data.news.value)))

first_web_page = web_data.web_pages.value[0]
first_web_page = web_data.news.value[0]
print("First web page name: {} ".format(first_web_page.name))
print("First web page URL: {} ".format(first_web_page.url))

Expand Down

0 comments on commit 43cd111

Please sign in to comment.