Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in ApiError.__init__ for api/v1/site ('list' object has no attribute 'get') #181

Open
3 tasks done
stsmrvestas opened this issue Dec 5, 2024 · 0 comments
Open
3 tasks done

Comments

@stsmrvestas
Copy link

stsmrvestas commented Dec 5, 2024

Prerequisites

  • Have you tested the operation in the API directly?
  • Do you have the latest SDK version?
  • Review the compatibility matrix before opening an issue.

Describe the bug
Using 2.3.7.6 for api/v1/site, querying for area via name = Global/EMEA/missing, the CCC UI gives 500 in the UI:

{
    "message": ["The input site is not valid or site is not present."]
}

This is compatible with the code, however when I use the SDK for the same query I get:

{
    "message": ["The input site is not valid or site is not present."],
    "response":[]
}

This empty response list breaks the ApiError.__init__, because it assumes response is either absent or a dict.
I realize this may actually be a bug in DNA Center rather than the SDK, but I figured it might be good to cater for the case where it actually sends an empty list for robustness?

Expected behavior
I've come to expect the ApiError exceptions when data is simply not there - I think the v2 approach with 200 + empty response is more sane, but for v1 the SDK should still be able to raise an ApiError with the message at least.
I'll migrate to the v2 endpoint which doesn't have this issue, but this is causing production issues as we didn't notices this in our testing prior to upgrading to the current version, and the fix seems quite small.
I don't think you really encourage PRs? If you wan't I could do one.

Screenshots
Screenshot from 2024-12-05 05-45-35

Environment (please complete the following information):

  • Cisco DNA Center Version and patch: 2.3.7.6-70319
  • Python version: 3.11
  • SDK version: 2.7.3 + 2.7.7
  • OS Version: Ubuntu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant