Ensure all json loads calls use strings
This commit is contained in:
parent
cf3b9782ac
commit
e0e4d4c87f
7 changed files with 36 additions and 4 deletions
|
@ -78,6 +78,10 @@ class PypoFetch(Thread):
|
|||
try:
|
||||
self.logger.info("Received event from Pypo Message Handler: %s" % message)
|
||||
|
||||
try:
|
||||
message = message.decode()
|
||||
except (UnicodeDecodeError, AttributeError):
|
||||
pass
|
||||
m = json.loads(message)
|
||||
command = m['event_type']
|
||||
self.logger.info("Handling command: " + command)
|
||||
|
|
|
@ -64,6 +64,10 @@ class PypoMessageHandler(Thread):
|
|||
try:
|
||||
self.logger.info("Received event from RabbitMQ: %s" % message)
|
||||
|
||||
try:
|
||||
message = message.decode()
|
||||
except (UnicodeDecodeError, AttributeError):
|
||||
pass
|
||||
m = json.loads(message)
|
||||
command = m['event_type']
|
||||
self.logger.info("Handling command: " + command)
|
||||
|
|
|
@ -197,7 +197,11 @@ class Recorder(Thread):
|
|||
def handle_message(self):
|
||||
if not self.queue.empty():
|
||||
message = self.queue.get()
|
||||
msg = json.loads(message)
|
||||
try:
|
||||
message = message.decode()
|
||||
except (UnicodeDecodeError, AttributeError):
|
||||
pass
|
||||
msg = json.loads(message)
|
||||
command = msg["event_type"]
|
||||
self.logger.info("Received msg from Pypo Message Handler: %s", msg)
|
||||
if command == 'cancel_recording':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue