Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adjustments to get the body parts properly. Yeah, I said that.

  • Loading branch information...
commit 9e5783dac24f2ea4fb8b18aa33aba8b88bc3ab02 1 parent f2a2bc1
@major authored
Showing with 7 additions and 3 deletions.
  1. +7 −3 alerts-to-prowl.py
View
10 alerts-to-prowl.py
@@ -26,9 +26,14 @@
# Read in the email from stdin
msg = email.message_from_file(sys.stdin)
-# We really only care about the subject and body
+# Grab the subject
subj = msg['Subject']
-body = msg.get_payload().strip()
+
+# Grab the body
+body = ''
+for part in msg.walk():
+ if part.get_content_type() == 'text/plain':
+ body += part.get_payload(decode=True)
# Prep a request for prowl
p = pyrowl.Pyrowl('PROWL API KEY')
@@ -39,4 +44,3 @@
event=subj,
description=body,
priority=2)
-

0 comments on commit 9e5783d

Please sign in to comment.
Something went wrong with that request. Please try again.