Bing Image Search client library doesn't work

Tin Nguyen 1 Reputation point
2021-04-01T01:20:35.34+00:00

Hi I have a problem when trying to reproduce code from this page https://learn.microsoft.com/en-us/azure/cognitive-services/bing-image-search/quickstarts/client-libraries?pivots=programming-language-python&tabs=visualstudio

pip install azure-cognitiveservices-search-imagesearch

Here is the code that I input in my Jupyter notebook

from azure.cognitiveservices.search.imagesearch import ImageSearchClient
from msrest.authentication import CognitiveServicesCredentials
subscription_key = **
subscription_endpoint = "https://api.bing.microsoft.com/"
search_term = "canadian rockies"
client = ImageSearchClient(endpoint=subscription_endpoint, credentials=CognitiveServicesCredentials(subscription_key))
image_results = client.images.search(query=search_term)

I get the following error:
ErrorResponseException: Operation returned an invalid status code 'Resource Not Found'

I have also tried using
subscription_endpoint = "https://api.bing.microsoft.com/v7.0/images/search"

I have also tried using my cognitive service endpoints and key as well but get a different error
ErrorResponseException: Operation returned an invalid status code 'Forbidden'

What are the difference between all API. What are the difference between cognitive service and bing resources (what are their functionalities, when and how should I use them)

Bing Image Search
Bing Image Search
A Bing service that supports searching for images and gets comprehensive results.
45 questions
Azure AI Search
Azure AI Search
An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
703 questions
{count} votes

1 answer

Sort by: Most helpful
  1. GiftA-MSFT 11,151 Reputation points
    2021-04-05T16:02:59.757+00:00

    Hi, Cognitive Image Search API got migrated to Microsoft Bing, please refer latest document. Ensure to use your Bing Resource Key as shown below. Let us know if you have further questions, thanks!

    84469-image.png

    0 comments No comments