Skip to content
Snippets Groups Projects
Verified Commit eb0f87b7 authored by nd's avatar nd
Browse files

add more escaping

parent 21cb0f3e
No related branches found
No related tags found
No related merge requests found
......@@ -37,12 +37,12 @@ def postAlertmanager(chatID):
elif alert['status'] == "firing":
correctDate = parser.parse(alert['startsAt']).strftime('%Y-%m-%d %H:%M:%S')
message += "Started: "+correctDate+"\n"
message = message.replace('-', '\-').replace('.', '\.') + "labels: \n```\n"
message = message.replace('-', '\-').replace('.', '\.').replace('!', '\!') + "labels: \n```\n"
for l in alert['labels']:
message += l + " : "+alert['labels'][l] + "\n"
message += "```"
bot.sendMessage(chat_id=chatID, text=message, parse_mode=telegram.ParseMode.MARKDOWN_V2)
return "Alert OK", 200
return "Alert OK", 200
except Exception as error:
bot.sendMessage(chat_id=chatID, text="Error to read json: "+str(error))
app.logger.info("\t%s",error)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment