azure-sdk-for-python icon indicating copy to clipboard operation
azure-sdk-for-python copied to clipboard

404 Using NewsSearchClient

Open BabellDev opened this issue 3 years ago • 7 comments

  • 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:

  1. Follow and run the quickstart code

Expected behavior Following the sample code should return a response with status 200.

BabellDev avatar Sep 29 '23 17:09 BabellDev

Thanks for reporting the issue. We will take a look.

xiangyan99 avatar Sep 29 '23 18:09 xiangyan99

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jaggerbodas-ms @arwong.

github-actions[bot] avatar Sep 29 '23 18:09 github-actions[bot]

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?

davecom avatar Nov 10 '23 04:11 davecom

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.

BabellDev avatar Nov 10 '23 14:11 BabellDev

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.

github-actions[bot] avatar Nov 10 '23 17:11 github-actions[bot]

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.

github-actions[bot] avatar Nov 17 '23 22:11 github-actions[bot]

Have the endpoints been fixed in the documentation? Is the example app working?

/unresolve

davecom avatar Nov 17 '23 22:11 davecom