mirror of https://github.com/MISP/PyMISP
commit
e0bf5b9d8f
|
@ -2282,11 +2282,9 @@ class PyMISP(object):
|
||||||
|
|
||||||
def get_object_template_id(self, object_uuid):
|
def get_object_template_id(self, object_uuid):
|
||||||
"""Gets the template ID corresponting the UUID passed as parameter"""
|
"""Gets the template ID corresponting the UUID passed as parameter"""
|
||||||
templates = self.get_object_templates_list()
|
url = urljoin(self.root_url, 'objectTemplates/view/{}'.format(object_uuid))
|
||||||
for t in templates:
|
response = self._prepare_request('GET', url)
|
||||||
if t['ObjectTemplate']['uuid'] == object_uuid:
|
return self._check_response(response)
|
||||||
return t['ObjectTemplate']['id']
|
|
||||||
raise Exception('Unable to find template uuid {} on the MISP instance'.format(object_uuid))
|
|
||||||
|
|
||||||
def update_object_templates(self):
|
def update_object_templates(self):
|
||||||
url = urljoin(self.root_url, '/objectTemplates/update')
|
url = urljoin(self.root_url, '/objectTemplates/update')
|
||||||
|
|
Loading…
Reference in New Issue