Skip to content

Commit

Permalink
Fix MQTT JSON decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Jan 8, 2020
1 parent cb7f4a7 commit 4714be5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fbchat/_mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ def connect(cls, state, on_message, chat_on, foreground):
def _on_message_handler(self, client, userdata, message):
# Parse payload JSON
try:
j = _util.parse_json(message.payload)
except _exception.FBchatFacebookError:
j = _util.parse_json(message.payload.decode("utf-8"))
except (_exception.FBchatFacebookError, UnicodeDecodeError):
log.exception("Failed parsing MQTT data on %s as JSON", message.topic)
return

Expand Down

0 comments on commit 4714be5

Please sign in to comment.