唤醒代理Python 2.7脚本

时间:2018-08-23 04:19:16

标签: python mcafee

因此,使用McAfee书“ epo_510_rg_Web API_0-00_zh-cn”,我试图实现示例2脚本来唤醒第22页上的代理...总之,我收到以下错误:

    C:\Users\Administrator\PycharmProjects\test\venv\Scripts\python.exe 
    C:/Users/Administrator/PycharmProjects/test/autoAgentWakeUp.py
    Traceback (most recent call last):
    File "C:/Users/Administrator/PycharmProjects/test/autoAgentWakeUp.py", line 14, in <module>
    result = mc.system.wakeupAgent(id)
    File "C:\Python27\Lib\mcafee.py", line 446, in __call__
    return self.invoker.invoke(self.prefix + '.' + self.name, argmap)
    File "C:\Python27\Lib\mcafee.py", line 271, in invoke
    if arg[:8] == 'file:///':
    TypeError: 'int' object has no attribute '__getitem__'

无论如何下面是我的代码,我怀疑该错误可能是由于在ePO 5.1上使用了ePO 5.3:

    import mcafee
    import ssl
    ssl.match_hostname= lambda cert, hostname: True
    mc = mcafee.client("localhost", "8443","admin","password")


    #code specific to this task
    input = "mytag" #

    systems = mc.system.find(input)#Search text can be IP address, MAC address, user 
    name, agent GUID or tag
    #The above uses the System Tree for searching
    for system in systems:
    id = system['EPOComputerProperties.ParentID']
    result = mc.system.wakeupAgent(id)

无论如何,我将继续调查此错误,看看是否能找到答案。

1 个答案:

答案 0 :(得分:0)

好的,所以我在这里发布后就设法解决了自己的问题。无论如何,出于某些原因:

    EPOComputerProperties.ParentID

将无法正常工作,因此我改用了设备的IP地址,是的,它确实很愚蠢,但是可以正常工作,所以我很高兴:

    id = system['EPOComputerProperties.ParentID']

因此将上面的行替换为下面的行

    id = system['EPOComputerProperties.IPAddress']