404 Using NewsSearchClient
- Package Name: azure-cognitiveservices-search-newssearch
- Package Version: 2.0.0
- Operating System: Windows 10
- Python Version: 3.10.7
Describe the bug Following the quickstart documentation results in (404 Resource Not Found).
I have found this to be due to formatting of the endpoint into the final request URL. The library adds /bing/v7.0/ to the URL, which is not correct.
I was able to work around this by hacking the base URL of the client config like so:
client = NewsSearchClient(
endpoint="https://api.bing.microsoft.com/",
credentials=CognitiveServicesCredentials("-----------------------"))
client.config.base_url = "{Endpoint}/v7.0"
news_result = client.news.search(query=query, market="en-us", count=4)
To Reproduce Steps to reproduce the behavior:
- Follow and run the quickstart code
Expected behavior Following the sample code should return a response with status 200.
Thanks for reporting the issue. We will take a look.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jaggerbodas-ms @arwong.
Thank you for posting this workaround. It's kind of strange that Azure can just have random endpoints go down with no fixes from Microsoft for extended periods of time. For example, the old Cognitive Search URL went down today, I guess because of a migration to Bing, and yet the new posted endpoint which has been listed for a long time doesn't work without this workaround from two months ago. Are there no automated tests in place that send someone an alert at Microsoft when sample code and/or more importantly endpoints don't work? Am I one of the only ones relying on the Bing News API daily?
Thank you for posting this workaround. It's kind of strange that Azure can just have random endpoints go down with no fixes from Microsoft for extended periods of time. For example, the old Cognitive Search URL went down today, I guess because of a migration to Bing, and yet the new posted endpoint which has been listed for a long time doesn't work without this workaround from two months ago. Are there no automated tests in place that send someone an alert at Microsoft when sample code and/or more importantly endpoints don't work? Am I one of the only ones relying on the Bing News API daily?
I'm glad the workaround is useful for you! I get the impression that the Bing News API may not be widely used, and perhaps even less so via the Python libraries. Otherwise I would expect a bit more noise around this issue.
Hi @BabellDev. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.
Hi @BabellDev, since you haven’t asked that we /unresolve the issue, we’ll close this out. If you believe further discussion is needed, please add a comment /unresolve to reopen the issue.
Have the endpoints been fixed in the documentation? Is the example app working?
/unresolve