diff --git a/apprise/plugins/NotifyDiscord.py b/apprise/plugins/NotifyDiscord.py index 72e7ac4c..e21447fe 100644 --- a/apprise/plugins/NotifyDiscord.py +++ b/apprise/plugins/NotifyDiscord.py @@ -317,7 +317,7 @@ class NotifyDiscord(NotifyBase): # Open our attachment path if required: if attach: - files = (attach.name, open(attach.path, 'rb')) + files = {'file': (attach.name, open(attach.path, 'rb'))} r = requests.post( notify_url, @@ -347,7 +347,8 @@ class NotifyDiscord(NotifyBase): return False else: - self.logger.info('Sent Discord notification.') + self.logger.info('Sent Discord {}.'.format( + 'attachment' if attach else 'notification')) except requests.RequestException as e: self.logger.warning( @@ -367,7 +368,7 @@ class NotifyDiscord(NotifyBase): # Close our file (if it's open) stored in the second element # of our files tuple (index 1) if files: - files[1].close() + files['file'][1].close() return True diff --git a/apprise/plugins/NotifySlack.py b/apprise/plugins/NotifySlack.py index b31fcf9f..62b3bcb7 100644 --- a/apprise/plugins/NotifySlack.py +++ b/apprise/plugins/NotifySlack.py @@ -487,7 +487,7 @@ class NotifySlack(NotifyBase): try: # Open our attachment path if required: if attach: - files = (attach.name, open(attach.path, 'rb')) + files = {'file': (attach.name, open(attach.path, 'rb'))} r = requests.post( url, @@ -622,7 +622,7 @@ class NotifySlack(NotifyBase): # Close our file (if it's open) stored in the second element # of our files tuple (index 1) if files: - files[1].close() + files['file'][1].close() # Return the response for processing return response