Fix: MISTags local field is jsonify as int

In MISP, MISPTag's local field is jsonify as an int, however
PyMISP jsonify it as a string. This is unexpected.
pull/1171/head
Sura De Silva 2024-03-06 13:40:59 +11:00
parent a7446b3263
commit 512019b413
1 changed files with 5 additions and 1 deletions

View File

@ -410,7 +410,11 @@ class MISPTag(AbstractMISP):
return '<{self.__class__.__name__}(name={self.name})>'.format(self=self)
return f'<{self.__class__.__name__}(NotInitialized)>'
def to_dict(self, json_format: bool = False) -> dict[str, Any]:
to_return = super().to_dict(json_format)
if to_return.get('local'):
to_return['local'] = int(to_return.get('local'))
return to_return
# UUID, datetime, date and Enum is serialized by ORJSON by default
def pymisp_json_default(obj: AbstractMISP | datetime | date | Enum | UUID) -> dict[str, Any] | str:
if isinstance(obj, AbstractMISP):