From 92beeb8d774517db2d18571b445d79e1e9b3622c Mon Sep 17 00:00:00 2001 From: GeoJulien Date: Thu, 17 Jun 2021 07:01:02 +0200 Subject: [PATCH] Use json loads/dumps to prevent encoding aleas --- isso/ext/notifications.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/isso/ext/notifications.py b/isso/ext/notifications.py index 0fc627eba..d0bf6c32f 100644 --- a/isso/ext/notifications.py +++ b/isso/ext/notifications.py @@ -382,12 +382,15 @@ def send(self, structured_msg: str) -> bool: :rtype: bool """ + # load the message to ensure encoding + msg_json = json.loads(structured_msg) + with Session() as requests_session: # send requests response = requests_session.post( url=self.wh_url, - data=structured_msg, + json=json.dumps(msg_json), headers={ "Content-Type": "application/json", "User-Agent": "Isso/{0} (+https://posativ.org/isso)".format(