mirror of https://github.com/MISP/PyMISPGalaxies
fix: Add support for namespaces in Galaxies
parent
994f4e779a
commit
9d71c04cf3
|
@ -50,13 +50,17 @@ class Galaxy():
|
||||||
self.description = self.galaxy['description']
|
self.description = self.galaxy['description']
|
||||||
self.version = self.galaxy['version']
|
self.version = self.galaxy['version']
|
||||||
self.uuid = self.galaxy['uuid']
|
self.uuid = self.galaxy['uuid']
|
||||||
|
self.namespace = self.galaxy.pop('namespace', None)
|
||||||
|
|
||||||
def to_json(self):
|
def to_json(self):
|
||||||
return json.dumps(self, cls=EncodeGalaxies)
|
return json.dumps(self, cls=EncodeGalaxies)
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
return {'type': self.type, 'name': self.name, 'description': self.description,
|
to_return = {'type': self.type, 'name': self.name, 'description': self.description,
|
||||||
'version': self.version, 'uuid': self.uuid, 'icon': self.icon}
|
'version': self.version, 'uuid': self.uuid, 'icon': self.icon}
|
||||||
|
if self.namespace:
|
||||||
|
to_return['namespace'] = self.namespace
|
||||||
|
return to_return
|
||||||
|
|
||||||
|
|
||||||
class Galaxies(collections.Mapping):
|
class Galaxies(collections.Mapping):
|
||||||
|
|
Loading…
Reference in New Issue