cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1275
Views
0
Helpful
1
Replies

How to use DnQuery with aci and cobra

stevemadel
Level 1
Level 1

I am following the tutorial located here to try and write some python code.  My eventual goal is to write some scripts to grab things like tenant health, contract drops, etc.  When I run the code located here I get the following error.  Any ideas?

 

Traceback (most recent call last):
  File "/PycharmProjects/aci_rest/auth.py", line 13, in <module>
    dnQuery = DnQuery('uni/tn-common')
NameError: name 'DnQuery' is not defined

1 Reply 1

Beau Poehls
Level 1
Level 1

Doesn't look like that link to the code is valid anymore. It looks like the error you're getting is because the DnQuery() function that you're calling isn't being called or import properly. There should be some import statements at the top of the code and there should be something similar to this to import the DnQuery function -

 

 

from cobra.mit.request import DnQuery

Do you have something like this?

 

Review Cisco Networking for a $25 gift card

Save 25% on Day-2 Operations Add-On License