06-17-2018 10:59 AM
I just want to know how to use the ACI session module. I am testing subscripting and would really like some very simple examples: such as
here is how to create the session
session = acisession(a,b,c)
here is how to start subscribing
subscribe = session.subscribe()
here is how to specify the class that you want to subscribe
subscribe = session.subscribe('aaaModLR')
06-17-2018 11:34 AM
made some progress, but I can't seem to get the count to increase, no matter what I do to the static binding. Any idea what's wrong with the code ?
session = acisession.Session(url, uid, pwd)
session.login()
count = session.get_event_count(url)
result = session.subscribe(url=url, only_new=True).json()
if count > 0:
print(result['imdata'][0]['fvRsPathAtt']['attributes']['dn'])
07-12-2023 06:57 AM - edited 07-12-2023 06:59 AM
I would try inserting print statement to see value of count and also print the type, as it may be string, that you would need to convert to integer.
print(f'(the count is {count} and it is of type {type(count)}')
You may also need to drill down into the 'session' object and see what else you can work with
print(dir(session))
*I'm assuming you're using Python3
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:
This community is intended for developer topics around Data Center technology and products. If you are looking for a non-developer topic about Data Center, you might find additional information in the Data Center and Cloud community