mirror of https://github.com/caronc/apprise
updated requests/files reference
parent
1a83623e3c
commit
f4a7df0520
|
@ -317,7 +317,7 @@ class NotifyDiscord(NotifyBase):
|
||||||
|
|
||||||
# Open our attachment path if required:
|
# Open our attachment path if required:
|
||||||
if attach:
|
if attach:
|
||||||
files = (attach.name, open(attach.path, 'rb'))
|
files = {'file': (attach.name, open(attach.path, 'rb'))}
|
||||||
|
|
||||||
r = requests.post(
|
r = requests.post(
|
||||||
notify_url,
|
notify_url,
|
||||||
|
@ -347,7 +347,8 @@ class NotifyDiscord(NotifyBase):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.logger.info('Sent Discord notification.')
|
self.logger.info('Sent Discord {}.'.format(
|
||||||
|
'attachment' if attach else 'notification'))
|
||||||
|
|
||||||
except requests.RequestException as e:
|
except requests.RequestException as e:
|
||||||
self.logger.warning(
|
self.logger.warning(
|
||||||
|
@ -367,7 +368,7 @@ class NotifyDiscord(NotifyBase):
|
||||||
# Close our file (if it's open) stored in the second element
|
# Close our file (if it's open) stored in the second element
|
||||||
# of our files tuple (index 1)
|
# of our files tuple (index 1)
|
||||||
if files:
|
if files:
|
||||||
files[1].close()
|
files['file'][1].close()
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -487,7 +487,7 @@ class NotifySlack(NotifyBase):
|
||||||
try:
|
try:
|
||||||
# Open our attachment path if required:
|
# Open our attachment path if required:
|
||||||
if attach:
|
if attach:
|
||||||
files = (attach.name, open(attach.path, 'rb'))
|
files = {'file': (attach.name, open(attach.path, 'rb'))}
|
||||||
|
|
||||||
r = requests.post(
|
r = requests.post(
|
||||||
url,
|
url,
|
||||||
|
@ -622,7 +622,7 @@ class NotifySlack(NotifyBase):
|
||||||
# Close our file (if it's open) stored in the second element
|
# Close our file (if it's open) stored in the second element
|
||||||
# of our files tuple (index 1)
|
# of our files tuple (index 1)
|
||||||
if files:
|
if files:
|
||||||
files[1].close()
|
files['file'][1].close()
|
||||||
|
|
||||||
# Return the response for processing
|
# Return the response for processing
|
||||||
return response
|
return response
|
||||||
|
|
Loading…
Reference in New Issue