47
47
48
48
49
49
class STOMPListener (stomp .ConnectionListener ):
50
- def on_error (self , headers , body ):
51
- print ('report_error' , body )
50
+ def on_error (self , frame ):
51
+ print ('report_error' , frame . body )
52
52
53
- def on_message (self , headers , body ):
54
- msg_json = json .loads (body )
53
+ def on_message (self , frame ):
54
+ msg_json = json .loads (frame . body )
55
55
56
56
for field , allowed in ALLOWLIST_FILTERS .items ():
57
57
if msg_json .get (field ) not in allowed :
@@ -70,10 +70,10 @@ def on_message(self, headers, body):
70
70
makedirs (path , exist_ok = True )
71
71
72
72
if WRITE_RAW_MAILS :
73
- with open (path_join (path , str (hash (body )) + '.eml' ), 'wb' ) as f :
73
+ with open (path_join (path , str (hash (frame . body )) + '.eml' ), 'wb' ) as f :
74
74
f .write (b64decode (msg_json ['original_message_base64_encoded' ]))
75
75
else :
76
- with open (path_join (path , str (hash (body )) + '.json' ), 'w' ) as f :
76
+ with open (path_join (path , str (hash (frame . body )) + '.json' ), 'w' ) as f :
77
77
json .dump (msg_json , f )
78
78
79
79
0 commit comments