-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError on unserializedMessage. #1
Comments
Here is the code I used to test: import json
from idmefv2 import Message, SerializedMessage
#List of Dict
LDok = json.loads(Sok)
msg = Message()
#Dict
for Dok in LDok :
payload = SerializedMessage('application/json', Dok)
msg = Message.unserialize(payload) With for example : |
Hi, Thank you for your report! Disclaimer: I do not work on this project anymore. The Try out the following code: import json
from idmefv2 import Message, SerializedMessage
# Notice how LDok[0] is now a byte sequence
LDok = [
b'''
{
"Version": "2.0.3",
"ID": "e5f9bbae-163e-42f9-a2f2-0daaf78fefb1",
"CreateTime": "2021-01-18T23:33:05.21Z",
"Analyzer": {
"IP": "172.10.5.31",
"Name": "Front door camera",
"Model": "Netatmo 42B",
"Category": ["HAR"],
"Data": ["Images"],
"Method": ["Movement"]
}
}
'''
]
for Dok in LDok :
payload = SerializedMessage('application/json', Dok)
msg = Message.unserialize(payload)
print(msg) Regards, |
Hello,
I tried to use the IDMEFv2 library on python. I enter a string that I transform in Json (so dictionary) with Json.loads(),
I create the payload with SerializedMessage() as in the README. But when I use the payload with the unserialize() function, I have a
TypeError : __bytes__ returned non-bytes (type dict).
Thanks for your answer.
The text was updated successfully, but these errors were encountered: