aboutsummaryrefslogtreecommitdiffstats
path: root/email_helpers.py
diff options
context:
space:
mode:
Diffstat (limited to 'email_helpers.py')
-rw-r--r--email_helpers.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/email_helpers.py b/email_helpers.py
index 8a71b09..8f5b2ac 100644
--- a/email_helpers.py
+++ b/email_helpers.py
@@ -11,6 +11,7 @@ import email
from email.utils import parseaddr, parsedate_to_datetime
import argparse
from bs4 import BeautifulSoup
+from pytz import timezone
SCOPES = 'https://www.googleapis.com/auth/gmail.modify'
CLIENT_SECRET_FILE = os.path.expanduser('~/client_id.json')
@@ -148,7 +149,9 @@ if __name__ == "__main__":
elif body.get_content_type() == 'text/plain':
comment = comment_cache = body.get_content()
news_id = int(m.groups()[0])
- date = parsedate_to_datetime(mail['Date'])
+ date = (parsedate_to_datetime(mail['Date']).
+ astimezone(timezone('utc')).
+ replace(tzinfo=None))
try:
db.execute(sql_str, (date, news_id, user_id, comment, comment_cache))
except sqlite3.Error as e: