how to obtain the enterprise licensed limits and amounts used with python api

jrmathieu63
Level 3
how to obtain the enterprise licensed limits and amounts used with python api

Trying to use get_licensing_status with DSSClient but the dictionary just reports NaN as values for base and limits for the userProfiles, licensedProfiles and profileLimits.

Example

 

 

license_info = pd.DataFrame(client.get_licensing_status())

 

 

 


Operating system used: AL2

0 Kudos
3 Replies
Turribeach

client.get_licensing_status() returns a Python dictionary so you have to do some coding to convert it to a data frame since it's not a tabular data structure. But it shouldn't be too hard to do it, it depends on what you want to get. 

Screenshot 2024-01-22 at 21.42.51.png

 

0 Kudos
jrmathieu63
Level 3
Author

While this info was help, it did still require more details to determine how to approach to extract the information required.

If inexperience as I am and not afraid to state that, I am provided the solution(s) I can up with to hopefully someone can provide some feedback on best approach or an improvement on this.

First and more straight forward.

license_info = client.get_licensing_status()
READER_MAX = license_info['limits']['profileLimits']['READER']['licensed']['licensedLimit']
READER_CNT= license_info['limits']['profileLimits']['READER']['directCount']
print('Reader Max', READER_MAX, 'Reader Count', READER_CNT)


 Second using a function.

def get_value(dict, *keys):
    # loop over the keys
    for key in keys:
        # get the value of the current key
        dict = dict.get(key)
        # if the value is None, return None
        if dict is None:
            return None
    # return the final value
    return dict

READER_MAX = get_value(license_info, 'limits', 'profileLimits', 'READER', 'licensed', 'licensedLimit')
READER_CNT = get_value(license_info, 'limits', 'profileLimits', 'READER', 'directCount')
# print the values
print('Reader Max', READER_MAX, 'Reader Count', READER_CNT)

 

0 Kudos

Thanks for posting back for others to benefit. The problems where one needs to work to get to the solution are the most rewarding in my view, as you get to learn in the process. The other thing to consider is that the scope of your original question was too wide open. There was no clarity of what you wanted to do with the output. The data was in a Python dictionary, so if this didn't suit your needs then you could have asked on how to extract the values which is what you ended up doing. 

0 Kudos