Querying CUCM via AXL using Python scripts – Installing Python

I’ve been looking for a step-by-step process for installing and configuring Python to use with AXL requests on either of my laptops (MacOS and Windows), but haven’t had much success finding the complete process.  Though most bloggers want to be and are extremely helpful, it seems like those who’ve posted How-to docs (that I’ve found) expect readers to already be experienced programmers or Python users. Now I’m not necessarily a programmer, per se, but I like to think I can interpret code and follow directions.

As a result of piecing together information from several complex Google searches, YouTube videos and Cisco documentation, I’ve pieced together the processes below for installing and configuring Python, installing the necessary packages AND most importantly performing successful queries against CUCM using AXL and RIS queries. I’ve linked to all of the blogs I’ve reviewed and compiled info from at the bottom of this article. Thank you to everyone who’s shared their processes!

Note: where commands are listed within ” “, omit the quotes when executing the command.

For Windows and MacOS:

  • install python3
    • Download latest installer for your OS from python.org and install. I’m using 3.6.4.
    • Choose the Customize Install option and tick the “Add Environment Variables” checkbox adn select your install path; otherwise select the “Install Now” option and manually add the python PATH variables to your system Environment Variables. *Does not apply to MacOS
      • Custom install, leave all options on first page selected, click Next.
        • Leave existing boxes checked AND select “Install for all users” as well as “Add Python to Environment Variables”.   Click Browse to select a different install path, then click “Install” to complete.
      • For default info, follow the prompts to install Python, then complete the two steps below to manually update the Environment variables.
        • add “;%PYTHON_HOME%\;%PYTHON_HOME%\Scripts\” to the end of your ‘Path’ variable and save the change. 
        • create a new “PYTHON_HOME” variable
          • Variable name: “PYTHON_HOME
          • Variable value: {path to your python install directory. e.g. c:\python36}
  • Load Python packages.
  • Launch a command prompt and execute the commands from any directory (assuming the PATH statements have been entered correctly).
    • run “easy_install pip
    • run “easy_install zeep
    • run “easy_install suds-jurko
    • run “easy_install xlsxwriter
  • Download and extract the Cisco AXL Toolkit file from CUCM (Plugins menu), note local path to the extracted files on your computer. For ease of future reference to the wsdl file, I suggest extracting it to the directory you will be writing and launching your scripts from.
    • Import wsdl into Python
    • Launch a command prompt and execute the command below to import the wsdl file
      • python -mzeep {local path}\AXLAPI.wsdl” (note, replace {local path] with the path to the extracted ALXAPI.wsdl file on your computer.
      • NOTE: your AXL file version should match the version on the CUCM server you’re querying, so if you query against multiple CUCM versions, you may need to change the path to the respective AXLAPI file, or prompt for the version number in your script and dynamically write the path using an if-else statement. 
  • Install an IDE/Text Editor like Atom (www.atom.io) for creating and editing Python scripts.

That’s it, you should be ready to execute Python scripts from a command prompt on your Windows machine with the command “python {scriptname}.py“.

For Mac:

Follow the same process as above; HOWEVER, the process differs on MacOS as follows:

  • Depending on permissions in MacOS, you may need to execute the commands as a super user (i.e.  prefix each command with “sudo ” and enter the super user password.
  • Instead of completing the steps above for setting the PATH variable on MacOS, the Python installer will automatically add the PATH statement to you .bash_profile file in your home directory.  If the .bash_profile file does not exist, the Python installer will create it.   Additionally, MacOS comes with Python 2.7 preinstalled.  This means when you run Python scripts with the command “python mscript.py”, MacOS will launch the script with Python 2.7.   If you want to use Python3 with your scripts, you will need to use the command “python3 myscript.py”, or alternatively you can add the following alias to the end of your .bash_profile file to always use Python3 regardless of how scripts are called.  

alias python='python3'

In both cases, if you have a command window or terminal session open while completing the process (which you will definitely need to do to execute the commands), you will have to close all terminal sessions/windows before changes to PATH variables or profiles are recognized.  That means if you still have your original terminal session active after completing the install and you execute the command “python –version” (same command on both platforms), you may see Python 2.7 returned as the active version.   In that case, close all terminal sessions, relaunch a terminal session and run the “python –version” command again.

Source websites and articles:





I also just found this one and updated my process above to reflect this excellent advice from Sam: