Merge pull request #71 from SekoiaLab/fix/remoteOrgUUID

fix: raise exception if uuid not setted in remote org
pull/77/head
Raphaël Vinot 2017-04-11 10:47:48 +02:00 committed by GitHub
commit 816bd0b6d5
1 changed files with 4 additions and 0 deletions

View File

@ -1261,6 +1261,10 @@ class PyMISP(object):
def add_organisation(self, name, **kwargs):
new_org = self._set_organisation_parameters(**dict(name=name, **kwargs))
session = self.__prepare_session()
if local in new_org:
if new_org.get('local') == False:
if 'uuid' not in new_org:
raise PyMISPError('A remote org MUST have a valid uuid')
url = urljoin(self.root_url, 'admin/organisations/add/')
response = session.post(url, data=json.dumps(new_org))
return self._check_response(response)