new: Add helpers for new server related APIs

Fix #266
pull/271/head
Raphaël Vinot 2018-08-26 23:41:51 -04:00
parent 47fc0ac3c6
commit 981e08a9ae
1 changed files with 19 additions and 0 deletions

View File

@ -1622,6 +1622,25 @@ class PyMISP(object):
response = self._prepare_request('POST', url, json.dumps(jdata))
return self._check_response(response)
def server_pull(self, server_id, event_id=None):
url = urljoin(self.root_url, 'servers/pull/{}'.format(server_id))
if event_id is not None:
url += '/{}'.format(event_id)
response = self._prepare_request('GET', url)
return self._check_response(response)
def server_push(self, server_id, event_id=None):
url = urljoin(self.root_url, 'servers/push/{}'.format(server_id))
if event_id is not None:
url += '/{}'.format(event_id)
response = self._prepare_request('GET', url)
return self._check_response(response)
def servers_index(self):
url = urljoin(self.root_url, 'servers/index')
response = self._prepare_request('GET', url)
return self._check_response(response)
# ############## Roles ##################
def get_roles_list(self):