Allow to set org_id and orgc_id when creating a new MISPEvent

Squashed commit of the following:

commit 8a5dfda8a728d8722dfba890729066948e744e44
Merge: 477f81d 332fc05
Author: Raphaël Vinot <raphael@vinot.info>
Date:   Tue Nov 15 09:52:26 2016 +0100

    Merge https://github.com/garanews/PyMISP into garanews-master

commit 332fc0508d3f5dc32cf962bd2cad1d800b6b4b02
Author: garanews <puntogtg@tiscali.it>
Date:   Mon Nov 14 15:29:04 2016 +0100

    Delete api_old.py

commit 7fb955fa2fba964ae7120f4cf56cf85e203efe96
Author: garanews <puntogtg@tiscali.it>
Date:   Mon Nov 14 14:05:22 2016 +0100

    Create api.py

commit 7f6f45d9ce8ec4e948c5b2513b9bc59296985e09
Author: garanews <puntogtg@tiscali.it>
Date:   Mon Nov 14 14:05:06 2016 +0100

    Rename api.py to api_old.py

commit 63c325816c2bda646f462a322eb3063788ab91a4
Author: garanews <puntogtg@tiscali.it>
Date:   Mon Nov 14 11:48:17 2016 +0100

    Add files via upload

commit edf0cd1d90e89c30a4d3ef756d6bc6501de3885f
Author: garanews <puntogtg@tiscali.it>
Date:   Wed Nov 2 15:31:42 2016 +0100

    Add files via upload
pull/30/head
Raphaël Vinot 2016-11-15 10:21:49 +01:00
parent 477f81d3ab
commit 6885779be5
1 changed files with 4 additions and 4 deletions

View File

@ -297,10 +297,10 @@ class PyMISP(object):
# ######### Event handling (Json only) #########
# ##############################################
def _prepare_full_event(self, distribution, threat_level_id, analysis, info, date=None, published=False):
def _prepare_full_event(self, distribution, threat_level_id, analysis, info, date=None, published=False, orgc_id=None, org_id=None):
misp_event = MISPEvent(self.describe_types)
misp_event.set_all_values(info=info, distribution=distribution, threat_level_id=threat_level_id,
analysis=analysis, date=date)
analysis=analysis, date=date, orgc_id=orgc_id, org_id=org_id)
if published:
misp_event.publish()
return misp_event
@ -341,8 +341,8 @@ class PyMISP(object):
e.threat_level_id = threat_level_id
return self.update_event(event['Event']['id'], json.dumps(e, cls=EncodeUpdate))
def new_event(self, distribution=None, threat_level_id=None, analysis=None, info=None, date=None, published=False):
misp_event = self._prepare_full_event(distribution, threat_level_id, analysis, info, date, published)
def new_event(self, distribution=None, threat_level_id=None, analysis=None, info=None, date=None, published=False, orgc_id=None, org_id=None):
misp_event = self._prepare_full_event(distribution, threat_level_id, analysis, info, date, published, orgc_id, org_id)
return self.add_event(json.dumps(misp_event, cls=EncodeUpdate))
def add_tag(self, event, tag):