rfc822 has been deprecated since Python 2.3, and it's gone in
Python 3 [1].
[1]: http://docs.python.org/2/library/rfc822.html
from __future__ import print_function
import datetime
-import rfc822
+import email.utils
import urllib
import json
import argparse
val = str.join(' ', val.split(None)[1:4])
val = str(datetime.datetime.strptime(val, '%d %b %Y').date())
elif header == 'from':
- (val, addr) = rfc822.parseaddr(val)
+ (val, addr) = email.utils.parseaddr(val)
if val == '':
val = addr.split('@')[0]