attempt at byte string to string fix when generating json

This commit is contained in:
jokob.sk
2022-10-16 16:57:46 +11:00
parent e0c8221a9c
commit c289e74e4a

View File

@@ -1632,7 +1632,7 @@ def send_webhook (_json, _html):
}
# DEBUG - Write the json payload into a log file for debugging
write_file (LOG_PATH + '/webhook_payload.json', str(_json_payload))
write_file (LOG_PATH + '/webhook_payload.json', json.dumps(_json_payload))
# Using the Slack-Compatible Webhook endpoint for Discord so that the same payload can be used for both
if(WEBHOOK_URL.startswith('https://discord.com/api/webhooks/') and not WEBHOOK_URL.endswith("/slack")):
@@ -1798,6 +1798,10 @@ def print_log (pText):
def add_json_list (row, list):
new_row = []
for column in row :
# if variable is of type bytes, convert to string
if isinstance(column, bytes):
column = column.decode('utf-8')
new_row.append(column)
list.append(new_row)