Skip to content

Commit

Permalink
fix: Disable WL when calling the disable method, not toggle.
Browse files Browse the repository at this point in the history
Fix #1159
  • Loading branch information
Rafiot committed Feb 22, 2024
1 parent 492cfba commit 94ff206
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pymisp/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1292,12 +1292,12 @@ def get_warninglist(self, warninglist: MISPWarninglist | int | str | UUID, pytho
w.from_dict(**wl)
return w

def toggle_warninglist(self, warninglist_id: str | int | list[int] | None = None, warninglist_name: str | list[str] | None = None, force_enable: bool = False) -> dict[str, Any] | list[dict[str, Any]]:
def toggle_warninglist(self, warninglist_id: str | int | list[int] | None = None, warninglist_name: str | list[str] | None = None, force_enable: bool | None = None) -> dict[str, Any] | list[dict[str, Any]]:
'''Toggle (enable/disable) the status of a warninglist by id: https://www.misp-project.org/openapi/#tag/Warninglists/operation/toggleEnableWarninglist
:param warninglist_id: ID of the WarningList
:param warninglist_name: name of the WarningList
:param force_enable: Force the warning list in the enabled state (does nothing if already enabled)
:param force_enable: Force the warning list in the enabled state (does nothing if already enabled) - None means toggle.
'''
if warninglist_id is None and warninglist_name is None:
raise PyMISPError('Either warninglist_id or warninglist_name is required.')
Expand All @@ -1312,7 +1312,7 @@ def toggle_warninglist(self, warninglist_id: str | int | list[int] | None = None
query['name'] = warninglist_name
else:
query['name'] = [warninglist_name]
if force_enable:
if force_enable is not None:
query['enabled'] = force_enable
response = self._prepare_request('POST', 'warninglists/toggleEnable', data=query)
return self._check_json_response(response)
Expand Down

0 comments on commit 94ff206

Please sign in to comment.