Doesn't require describe_types in MISPAttribute's constructor.

pull/99/head
Raphaël Vinot 2017-07-26 10:10:12 +02:00
parent c97b4de70d
commit 41b5672360
1 changed files with 6 additions and 1 deletions

View File

@ -50,7 +50,12 @@ except NameError:
class MISPAttribute(object): class MISPAttribute(object):
def __init__(self, describe_types): def __init__(self, describe_types=None):
if not describe_types:
with open(os.path.join(self.ressources_path, 'describeTypes.json'), 'r') as f:
t = json.load(f)
describe_types = t['result']
self.describe_types = describe_types
self.categories = describe_types['categories'] self.categories = describe_types['categories']
self.types = describe_types['types'] self.types = describe_types['types']
self.category_type_mapping = describe_types['category_type_mappings'] self.category_type_mapping = describe_types['category_type_mappings']