Hi Jeremy and FastAI team,
I am having a bit of trouble using the Bing Search Images and I’m stuck at the moment.
I’ve successfully acquired the api key and endpoint and followed this guide of using the API: Bing Image Search Python client library quickstart - Bing Search Services | Microsoft Learn
However I still get an Error that I cannot figure out a solution to. Following is the code that I wrote and the error message:
import os
key = os.environ[‘AZURE_SEARCH_KEY’]
endpoint = “https://api.bing.microsoft.com/v7.0/images/search”
search_term=“dog”
#Create an instance of CognitiveServicesCredentials
client = ImageSearchClient(endpoint=endpoint, credentials=CognitiveServicesCredentials(key))
image_results = client.images.search(query=search_term)
Error(at last line:image_results):
ErrorResponseException Traceback (most recent call last)
Cell In[52], line 1
----> 1 image_results = client.images.search(query=search_term)
File ~/.local/lib/python3.11/site-packages/azure/cognitiveservices/search/imagesearch/operations/_images_operations.py:491, in ImagesOperations.search(self, query, accept_language, user_agent, client_id, client_ip, location, aspect, color, country_code, count, freshness, height, id, image_content, image_type, license, market, max_file_size, max_height, max_width, min_file_size, min_height, min_width, offset, safe_search, size, set_lang, width, custom_headers, raw, **operation_config)
488 response = self._client.send(request, stream=False, **operation_config)
490 if response.status_code not in [200]:
→ 491 raise models.ErrorResponseException(self._deserialize, response)
493 deserialized = None
494 if response.status_code == 200:
ErrorResponseException: Operation returned an invalid status code ‘Resource Not Found’