def getComputerGroupId(groupSearch, username, password):
groupSearch_normalized = urllib2.quote(groupSearch)
reqStr = jss_api_base_url + '/computergroups/name/' + groupSearch_normalized
r = sendAPIRequest(reqStr, username, password, 'GET')
if r != -1:
responseCode = r.code
#print 'Response Code: ' + str(responseCode)
baseXml = r.read()
responseXml = etree.fromstring(baseXml)
computerGroupId = responseXml.find('id').text
#print computerGroupId
return computerGroupId
else:
#print 'Group not found.'
return -1
评论列表
文章目录