Pārlūkot izejas kodu

Initial script that does the appropriate parsing

Joe Ceresini 7 gadi atpakaļ
vecāks
revīzija
a54354e763
1 mainītis faili ar 31 papildinājumiem un 0 dzēšanām
  1. 31 0
      do-parse.py

+ 31 - 0
do-parse.py

@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+
+from mailparse import parse_maildir_inbox
+
+
+#####################################################
+## Mail parsers here
+#####################################################
+
+# AWS support cases update appropriate RightNow tickets
+def parser_aws_support_case_update(msg):
+	return True
+
+# Known garbage, simply delete
+def parser_delete(msg):
+	return True
+
+
+#####################################################
+## Mapping of incoming email subjets to parsers
+#####################################################
+
+subject_parsers = [
+	( r"\[Case ([0-9]+)\]", parser_aws_support_case_update ),
+	( r"Welcome to Amazon Web Services", parser_delete ),
+	( r"Your AWS Account is Ready", parser_delete )
+]
+
+if __name__ == "__main__":
+
+	parse_maildir_inbox('/home/incoming/Maildir',subject_parsers)