Encode ntfy payload

This commit is contained in:
JonnyWong16 2024-08-31 16:10:00 -07:00
parent 5cf39cb097
commit 330b8a3a82
No known key found for this signature in database
GPG key ID: B1F1F9807184697A

View file

@ -2614,7 +2614,7 @@ class NTFY(Notifier):
method = "POST"
url = f"{self.config['host']}/{self.config['topic']}"
params = {}
data = body
data = body.encode('utf-8')
headers = {
'Priority': self.config['priority'],
'Authorization': f'Bearer {self.config["access_token"]}',
@ -2623,7 +2623,7 @@ class NTFY(Notifier):
# Add optional subject
if self.config['incl_subject']:
headers['Title'] = subject
headers['Title'] = subject.encode('utf-8')
# Add optional parameters (dependent on notification type + metadata extraction)
if kwargs.get('parameters', {}).get('media_type'):
@ -2634,7 +2634,7 @@ class NTFY(Notifier):
if self.config['incl_description']:
description = pretty_metadata.get_description()
if description:
data = f"{data}\n\n{description}"
data += f"\n\n{description}".encode('utf-8')
# Add optional poster
if self.config['incl_poster']: