|
@@ -13,6 +13,7 @@ import locale
|
|
import argparse
|
|
import argparse
|
|
import datetime
|
|
import datetime
|
|
import traceback
|
|
import traceback
|
|
|
|
+import HTMLParser
|
|
import argcomplete
|
|
import argcomplete
|
|
|
|
|
|
# strptime
|
|
# strptime
|
|
@@ -62,12 +63,16 @@ def parse_amazon(msg):
|
|
|
|
|
|
def parse_oebb(msg):
|
|
def parse_oebb(msg):
|
|
|
|
|
|
- msg_text = msg.get_payload(decode = True).decode('utf8')
|
|
|
|
|
|
+ msg_text = re.sub(
|
|
|
|
+ r'<[^>]+>',
|
|
|
|
+ '',
|
|
|
|
+ HTMLParser.HTMLParser().unescape(msg.get_payload(decode = True).decode('utf8'))
|
|
|
|
+ )
|
|
|
|
|
|
order_match = re.search(
|
|
order_match = re.search(
|
|
- ur'Booking code: (?P<order_id>[\d ]+)\s+'
|
|
|
|
- + ur'Customer number: (?P<customer_id>PV\d+)\s+'
|
|
|
|
- + ur'Booking date: (?P<order_date>.* \d{4})\s',
|
|
|
|
|
|
+ ur'Booking code:\s+(?P<order_id>[\d ]+)\s+'
|
|
|
|
+ + ur'Customer number:\s+(?P<customer_id>PV\d+)\s+'
|
|
|
|
+ + ur'Booking date:\s+(?P<order_date>.* \d{4})\s',
|
|
msg_text,
|
|
msg_text,
|
|
re.MULTILINE | re.UNICODE
|
|
re.MULTILINE | re.UNICODE
|
|
)
|
|
)
|
|
@@ -83,7 +88,7 @@ def parse_oebb(msg):
|
|
ur'(?P<price_brutto_currency>.)(?P<price_brutto>\d+\.\d+)'
|
|
ur'(?P<price_brutto_currency>.)(?P<price_brutto>\d+\.\d+)'
|
|
+ ur'[\W\w]+'
|
|
+ ur'[\W\w]+'
|
|
+ ur'Your Booking\s+'
|
|
+ ur'Your Booking\s+'
|
|
- + ur'(?P<departure_point>.*) > (?P<destination_point>.*)',
|
|
|
|
|
|
+ + ur'(?P<departure_point>.*)\s+>\s+(?P<destination_point>.*)',
|
|
msg_text,
|
|
msg_text,
|
|
re.MULTILINE | re.UNICODE
|
|
re.MULTILINE | re.UNICODE
|
|
)
|
|
)
|