Merge pull request #22 from 3c7/patch-1

Fixes: expected bytes, got <class 'str'> in download_samples()
pull/24/head
Raphaël Vinot 2016-07-21 15:20:31 +02:00 committed by GitHub
commit 328e3b7a92
1 changed files with 2 additions and 2 deletions

View File

@ -917,10 +917,10 @@ class PyMISP(object):
archive = zipfile.ZipFile(zipped) archive = zipfile.ZipFile(zipped)
try: try:
# New format # New format
unzipped = BytesIO(archive.open(f['md5'], pwd='infected').read()) unzipped = BytesIO(archive.open(f['md5'], pwd=b'infected').read())
except KeyError: except KeyError:
# Old format # Old format
unzipped = BytesIO(archive.open(f['filename'], pwd='infected').read()) unzipped = BytesIO(archive.open(f['filename'], pwd=b'infected').read())
details.append([f['event_id'], f['filename'], unzipped]) details.append([f['event_id'], f['filename'], unzipped])
except zipfile.BadZipfile: except zipfile.BadZipfile:
# In case the sample isn't zipped # In case the sample isn't zipped