From 4ecfc1ada4583945d45164662cf3afe922e2678e Mon Sep 17 00:00:00 2001 From: Adrien RAFFIN Date: Thu, 6 Apr 2017 14:52:50 +0200 Subject: [PATCH] feat: add filter to specify which organisation to list --- pymisp/api.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pymisp/api.py b/pymisp/api.py index 3f2c723..10fac6b 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -1243,9 +1243,12 @@ class PyMISP(object): organisation['local'] = kwargs.get('local') return organisation - def get_organisations_list(self): + def get_organisations_list(self, scope="local"): session = self.__prepare_session() - url = urljoin(self.root_url, 'organisations') + scope=scope.lower() + if scope not in ["local", "external", "all"]: + raise ValueError("Authorized fields are 'local','external' or 'all'") + url = urljoin(self.root_url, 'organisations/index/scope:{}'.format(scope)) response = session.get(url) return self._check_response(response)['response']