mirror of https://github.com/MISP/PyMISP
Fix pep8
parent
d64831f215
commit
f54e92ab81
|
@ -566,7 +566,7 @@ class PyMISP(object):
|
||||||
def prepare_attribute(self, event_id, distribution, to_ids, category, info,
|
def prepare_attribute(self, event_id, distribution, to_ids, category, info,
|
||||||
analysis, threat_level_id):
|
analysis, threat_level_id):
|
||||||
to_post = {'request': {}}
|
to_post = {'request': {}}
|
||||||
authorized_categs = ['Payload delivery', 'Artifacts dropped', 'Payload Installation', 'External Analysis','Antivirus detection']
|
authorized_categs = ['Payload delivery', 'Artifacts dropped', 'Payload Installation', 'External Analysis', 'Antivirus detection']
|
||||||
|
|
||||||
if event_id is not None:
|
if event_id is not None:
|
||||||
try:
|
try:
|
||||||
|
@ -619,14 +619,14 @@ class PyMISP(object):
|
||||||
return self._check_response(response)
|
return self._check_response(response)
|
||||||
|
|
||||||
def upload_attachment(self, filename, filepath, event_id, distribution, to_ids,
|
def upload_attachment(self, filename, filepath, event_id, distribution, to_ids,
|
||||||
category, info, analysis, threat_level_id):
|
category, info, analysis, threat_level_id):
|
||||||
to_post = self.prepare_attribute(event_id, distribution, to_ids, category,
|
to_post = self.prepare_attribute(event_id, distribution, to_ids, category,
|
||||||
info, analysis, threat_level_id)
|
info, analysis, threat_level_id)
|
||||||
to_post['request']['files'] = [{'filename': filename, 'data': self._encode_file_to_upload(filepath)}]
|
to_post['request']['files'] = [{'filename': filename, 'data': self._encode_file_to_upload(filepath)}]
|
||||||
return self._upload_sample(to_post)
|
return self._upload_sample(to_post)
|
||||||
|
|
||||||
def upload_attachmentlist(self, filepaths, event_id, distribution, to_ids, category,
|
def upload_attachmentlist(self, filepaths, event_id, distribution, to_ids, category,
|
||||||
info, analysis, threat_level_id):
|
info, analysis, threat_level_id):
|
||||||
to_post = self.prepare_attribute(event_id, distribution, to_ids, category,
|
to_post = self.prepare_attribute(event_id, distribution, to_ids, category,
|
||||||
info, analysis, threat_level_id)
|
info, analysis, threat_level_id)
|
||||||
files = []
|
files = []
|
||||||
|
@ -636,14 +636,13 @@ class PyMISP(object):
|
||||||
files.append({'filename': os.path.basename(path), 'data': self._encode_file_to_upload(path)})
|
files.append({'filename': os.path.basename(path), 'data': self._encode_file_to_upload(path)})
|
||||||
to_post['request']['files'] = files
|
to_post['request']['files'] = files
|
||||||
return self._upload_sample(to_post)
|
return self._upload_sample(to_post)
|
||||||
|
|
||||||
def _upload_attachment(self, to_post):
|
def _upload_attachment(self, to_post):
|
||||||
session = self.__prepare_session('json')
|
session = self.__prepare_session('json')
|
||||||
url = urljoin(self.root_url, 'events/upload_attachment')
|
url = urljoin(self.root_url, 'events/upload_attachment')
|
||||||
response = session.post(url, data=json.dumps(to_post))
|
response = session.post(url, data=json.dumps(to_post))
|
||||||
return self._check_response(response)
|
return self._check_response(response)
|
||||||
|
|
||||||
|
|
||||||
# ############################
|
# ############################
|
||||||
# ######## Proposals #########
|
# ######## Proposals #########
|
||||||
# ############################
|
# ############################
|
||||||
|
|
Loading…
Reference in New Issue