Closed mlamoure closed 6 years ago
It would probably be better to just use requests
for both types. Define files
as an empty dictionary, then set "attachment"
in it if it's not empty in msgAttachment
.
It would also be good to print the result of the request to the debug log like the other one is doing with self.debugLog(r.text)
.
Also, if the image is more than 2.5Mb, the request will fail, so it might be good to check the size of the image file passed first and just not include it if it's too big so that the notification text isn't lost for what might be a critical event.
That makes sense. I've added those items and run some tests myself.