fix: Python 2.7 support

I want a cookie.
pull/452/head
Raphaël Vinot 2019-09-04 14:34:53 +02:00
parent 9df636cd37
commit 7912df8f37
1 changed files with 3 additions and 0 deletions

View File

@ -336,6 +336,9 @@ class MISPAttribute(AbstractMISP):
@data.setter
def data(self, data):
if sys.version_info <= (3, ):
if isinstance(data, unicode):
self._data = BytesIO(base64.b64decode(data.encode()))
if sys.version_info >= (3, 6):
if isinstance(data, Path):
with data.open('rb') as f: