various fixes
[distro-setup] / email-date.py
1 #!/usr/bin/env python3
2
3 # unused. was in a mail archiving script, but its too slow.
4
5 from email.parser import BytesParser, Parser
6 from email.policy import default
7 from pathlib import Path
8 from email.utils import mktime_tz, parsedate_tz
9 import sys
10 with open(sys.argv[1], 'rb') as fp:
11 headers = BytesParser(policy=default).parse(fp)
12 print(mktime_tz(parsedate_tz(headers['date'])))