mail parser basement

Subbranch
Rob 3 years ago
parent 8c7f7ce04c
commit 088edd7280
  1. 25
      src/Mail/parser/Bahn.py
  2. 0
      src/Mail/parser/__init__.py
  3. 9
      src/Mail/thunderbird.py

@ -0,0 +1,25 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
A parser to get events of Bahn.de out of there Emails
'''
'''
A parser to get events of Bahn.de out of there Emails
'''
class Bahn:
'''
@param input must be string with html
@return all events as list
'''
@staticmethod
def getEvents(html):
#hier mit beautifulsoup events rausholen und in liste packen
events = []
return events

@ -7,6 +7,9 @@ import mailbox
import email.header
import email.message
from parser.Bahn import Bahn
if 2 != len(sys.argv):
print("Error. Please povide your mailbox file (mbox) as parameter with the script!")
exit()
@ -45,5 +48,9 @@ mbox = mailbox.mbox(mboxfile)
for message in mbox:
mFrom = decode_mime_words(message['from'])
mSubject = decode_mime_words(message['subject'])
print( getbody(message))
mContent = getbody(message)
if mFrom == 'BahnCard-Service <noreply.bahncard-service@bahn.de>':
events = Bahn.getEvents(mContent)
print(events)

Loading…
Cancel
Save