05-23-2017 08:18 AM - edited 03-01-2019 05:14 AM
Trying to use the attached code and am getting the following KeyError. Any ideas?
python3 get-network-hosts.py
/usr/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
{'totalCount': '1', 'imdata': [{'error': {'attributes': {'code': '6', 'text': 'Output format was not specified (possible options: .xml|.json)'}}}]}
Traceback (most recent call last):
File "get-network-hosts.py", line 50, in <module>
ticket = r_json["response"]["serviceTicket"]
KeyError: 'response'
05-27-2017 04:34 PM
Stevemadel,
A few things come to mind:
1. In general, KeyErrors imply that you are trying to search on a key that likely doesn't exist. In this case, it is looking for an entry named 'response' within a json dump and is likely not finding it.
2. It looks like that script may have come from this python lab within Cisco DevNet. Assuming you have followed the previous steps correctly, it may be better for you to ask your question on the DevNet Forums as it may have more experts who have run through this lab who can better identify your issue as it specifically pertains to the Lab.
3. The lab and script details look to pertain to the APIC-EM as opposed to the APIC for ACI. The support forum page for the APIC-EM platform can be found here:
Network Management (Including APIC-EM) Support Forums
-Gabriel
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide