From 208091dc47abc39361fa1be79e7574470c9530d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Thu, 6 Aug 2015 09:49:44 +0200 Subject: [PATCH] Fix last commit --- examples/upload.py | 5 ++++- pymisp/api.py | 7 +++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/upload.py b/examples/upload.py index c4bde86..5148b51 100755 --- a/examples/upload.py +++ b/examples/upload.py @@ -14,7 +14,7 @@ def init(url, key): def upload_files(m, eid, paths, distrib, ids, categ, info, analysis, threat): - out = m.upload_sample(eid, paths, distrib, ids, categ, info, analysis, threat) + out = m.upload_samplelist(paths, eid, distrib, ids, categ, info, analysis, threat) if out.status_code == 200: print("Files uploaded sucessfully") else: @@ -41,5 +41,8 @@ if __name__ == '__main__': files = [args.upload] elif os.path.isdir(args.upload): files = [f for f in glob.iglob(os.path.join(args.upload + '*'))] + else: + print('invalid file') + exit(0) upload_files(misp, args.event, files, args.distrib, args.ids, args.categ, args.info, args.analysis, args.threat) diff --git a/pymisp/api.py b/pymisp/api.py index 856be4d..96e2c5a 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -147,12 +147,11 @@ class PyMISP(object): def prepare_attribute(self, event_id, distribution, to_ids, category, info, analysis, threat_level_id): - to_post = {'request': {'files': []}} + to_post = {'request': {}} if not isinstance(event_id, int): # New event - postcontent = self._create_event(distribution, threat_level_id, - analysis, info) - to_post['request'].update(postcontent) + to_post['request'].update(self._create_event(distribution, threat_level_id, + analysis, info)) else: to_post['request'].update({'event_id': int(event_id)})