Ignore acitoolkit HTTPS warnings

The main way of interacting with the APIC (controller element of Cisco ACI) is via its Rest API. In fact the out of the box web GUI is built on top of it.

This makes automation and programming the controller much easier than our traditional methods of configuring individual elements and devices via SSH and the CLI (the human API).

One great way to automate is with UCS Director (or another automation solution if you want to do the integration yourself). It is however not the only way you can automate, you could create a number of scripts.

To make life easier someone has created a number of Python libraries, called acitoolkit, for interacting with the API. Some great examples exist that you and try in the GitHub location.

Its based on Python 2.7, although I did see someone looking to merge back into the master updates that would allow support for Python 3 as well (I will probably start updating my scripts when its committed).

In my lab the ACI fabrics I have don’t always have certificates, incorrect self-sign certs or no FQDN which results in errors being returned.

/Library/Python/2.7/site-packages/requests-2.5.0-py2.7.egg/requests/packages/urllib3/connectionpool.py:734: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
	  InsecureRequestWarning)  

When people use example scripts to show what's possible its not always ideal for the errors to be displayed to the screen every time (and in some cases you can get 10s of them). A common question I see is can you fix it or hide the message. In the lab its not always easy to fix the root cause especially when its a moving goal post.

The good news is its relatively easy to stop the messages being presented to the user. Try adding the following lines to you script;

import requests
requests.packages.urllib3.disable_warnings()

NOTE: If you are looking to deploy in a production environment I would strongly recommend fixing the root of the problem rather than covering your eyes.

Show Comments

Get the latest posts delivered right to your inbox.