def __init__(self, url, creds=None, default_namespace='root/cimv2', x509=None, verify_callback=None, ca_certs=None, no_verification=False, timeout=None): assert (verify_callback is None) assert (ca_certs is None) assert (timeout is None) connection = _lmiwbem.WBEMConnection(url, creds, default_namespace, x509, no_verification) # We need this syntax, if you do self._c you will explode! object.__setattr__(self, '_c', connection)
# To make this example work, modify following variables: # hostname # username # password # cls import lmiwbem hostname = 'hostname' username = '******' password = '******' cls = 'LMI_Account' max_obj_cnt = 16 # Connect to CIMOM. conn = lmiwbem.WBEMConnection() conn.connect(hostname, username, password) # Open an instance enumeration. accounts_all, ctx, end = conn.OpenEnumerateInstances(cls, 'root/cimv2', DeepInheritance=True, IncludeClassOrigin=True, PropertyList=None, MaxObjectCnt=max_obj_cnt) # Pull the rest of instances. while not end: accounts, ctx, end = conn.PullInstances(ctx, MaxObjectCnt=max_obj_cnt) accounts_all.extend(accounts)
#!/usr/bin/python # # Author: Peter Hatina <*****@*****.**> # # This example demonstrates how to perform Unix socket connection to CIMOM. import lmiwbem conn = lmiwbem.WBEMConnection() conn.connectLocally() # Do something useful. conn.disconnect() # ------------------------------------- conn = lmiwbem.WBEMConnection(connect_locally=True) conn.connect() # No need to call connectLocally(). # Do something useful. conn.disconnect()