Fixes Discord error code 50006 when sending message (#180)

pull/181/head
Chris Caron 5 years ago committed by GitHub
parent 4692941efa
commit 054b674852
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -42,6 +42,7 @@
# #
import re import re
import requests import requests
from json import dumps
from .NotifyBase import NotifyBase from .NotifyBase import NotifyBase
from ..common import NotifyImageSize from ..common import NotifyImageSize
@ -319,9 +320,12 @@ class NotifyDiscord(NotifyBase):
if attach: if attach:
files = {'file': (attach.name, open(attach.path, 'rb'))} files = {'file': (attach.name, open(attach.path, 'rb'))}
else:
headers['Content-Type'] = 'application/json; charset=utf-8'
r = requests.post( r = requests.post(
notify_url, notify_url,
data=payload, data=payload if files else dumps(payload),
headers=headers, headers=headers,
files=files, files=files,
verify=self.verify_certificate, verify=self.verify_certificate,

Loading…
Cancel
Save