new: Method `organisation_exists`

pull/779/head
Jakub Onderka 2021-06-22 17:20:53 +02:00 committed by Raphaël Vinot
parent fcacc9274d
commit 6aa6c7d8bd
1 changed files with 9 additions and 0 deletions

View File

@ -2062,6 +2062,15 @@ class PyMISP:
o.from_dict(**organisation_j)
return o
def organisation_exists(self, organisation: Union[MISPOrganisation, int, str, UUID]) -> bool:
"""Fast check if organisation exists.
:param organisation: Organisation to check
"""
organisation_id = get_uuid_or_id_from_abstract_misp(organisation)
r = self._prepare_request('HEAD', f'organisations/view/{organisation_id}')
return self._check_head_response(r)
def add_organisation(self, organisation: MISPOrganisation, pythonify: bool = False) -> Union[Dict, MISPOrganisation]:
"""Add an organisation