Bing Search API returns the "Resource Not Found" error

Arash Vafanejad 1 Reputation point
2021-04-14T17:55:36.45+00:00

I'm following the quickstart code here: https://learn.microsoft.com/en-us/azure/cognitive-services/bing-web-search/quickstarts/client-libraries?pivots=programming-language-python
I'm using a Bing Resource with the Free Tier.
The endpoint I'm using is https://api.bing.microsoft.com/

87865-image.png

Why am I getting these errors and how to solve the issue?

Bing Web Search
Bing Web Search
A Bing service that gives you enhanced search details from billions of web documents.
127 questions
Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
2,364 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. GiftA-MSFT 11,151 Reputation points
    2021-04-14T21:59:08.957+00:00

    Hi, thanks for reaching out. The 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!

    87971-image.png

    0 comments No comments

  2. Arash Vafanejad 1 Reputation point
    2021-04-16T20:51:31.61+00:00

    Thank you very much, but this did not solve the issue,
    Also I am trying to use Bing search rather than image search.

    Could you please direct me to the document regarding news search (similar to the one I shard in the first post)

    I get the following error:

    HTTPError Traceback (most recent call last)
    <ipython-input-7-808139fa1eb0> in <module>
    1 response = requests.get(search_url, headers=headers, params=params)
    ----> 2 response.raise_for_status()
    3 search_results = response.json()
    4 thumbnail_urls = [img["thumbnailUrl"] for img in search_results["value"][:16]]

    /usr/local/lib/python3.9/site-packages/requests/models.py in raise_for_status(self)
    941
    942 if http_error_msg:
    --> 943 raise HTTPError(http_error_msg, response=self)
    944
    945 def close(self):

    HTTPError: 401 Client Error: PermissionDenied for url: https://api.bing.microsoft.com/v7.0/images/search?q=puppies&license=public&imageType=photo