File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 1- from azure .cognitiveservices .search .imagesearch import ImageSearchAPI
1+ from azure .cognitiveservices .search .imagesearch import ImageSearchClient
22from msrest .authentication import CognitiveServicesCredentials
33
4- # Add your Bing Search V7 subscription key to your environment variables.
5- subscription_key = os .environ ['BING_SEARCH_V7_SUBSCRIPTION_KEY' ]
4+ # Add your Bing Search V7 subscription key and endpoint to your environment variables.
5+ SUBSCRIPTION_KEY = os .environ ['BING_SEARCH_V7_SUBSCRIPTION_KEY' ]
6+ ENDPOINT = os .environ ['BING_ENTITY_SEARCH_ENDPOINT' ]
7+
68search_term = "canadian rockies"
79
810"""
911This application will search images on the web with the Bing Image Search API and print out first image result.
1012"""
1113# create the image search client
12- client = ImageSearchAPI ( CognitiveServicesCredentials (subscription_key ))
14+ client = ImageSearchClient ( ENDPOINT , CognitiveServicesCredentials (SUBSCRIPTION_KEY ))
1315# send a search query to the Bing Image Search API
1416image_results = client .images .search (query = search_term )
1517print ("Searching the web for images of: {}" .format (search_term ))
You can’t perform that action at this time.
0 commit comments