This script will collect the devices from XIQ using API, then build a CSV listing out each building and how many of each product type are there.
At the top of the script there are some variables that need to be added.
- XIQ_API_token - Update this with a valid token. The token will need the device_list or device:r permission
Note: If XIQ_API_token is blank, the script will prompt for XIQ user credentials
- pageSize - This is set to 100 which is the max number of devices that can be returned per API call. This can be lowered if needed.
- csv_file_name - this is the name of the file that will be saved.
- proxyDict - if a proxy is used you can fill out the http and https to be used.
proxyDict = {
"http": "",
"https": ""
}
open the terminal to the location of the script and run this command.
python XIQ_Device_Count_Per_Loc.py
There is an optional flag that can be added to the script when running.
--csv name_of_file.csv
This flag will override the csv_file_name variable, allowing you to change the output file name without having to open the script every time. You can add the flag when running the script.
python XIQ_Device_Count_Per_Loc.py --csv New_Device_Count.csv
There are additional modules that need to be installed in order for this script to function. They are listed in the requirements.txt file and can be installed with the command 'pip install -r requirements.txt' if using pip.