aboutsummaryrefslogtreecommitdiffstats
path: root/email_helpers.py
diff options
context:
space:
mode:
Diffstat (limited to 'email_helpers.py')
-rw-r--r--email_helpers.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/email_helpers.py b/email_helpers.py
index eeb2168..a3e2b29 100644
--- a/email_helpers.py
+++ b/email_helpers.py
@@ -134,13 +134,13 @@ if __name__ == "__main__":
"(date, news_id, user_id, content, content_cache) " \
"VALUES(?, ?, ?, ?, ?)"
try:
- with open('.pickle') as fh:
+ with open('.pickle', 'rb') as fh:
already_seen = pickle.load(fh)
except FileNotFoundError:
already_seen = set()
for msg_id in ListMessagesWithLabels(GmailMessage._service, 'me', 'INBOX'):
- if msg_id in already_seen:
+ if msg_id['id'] in already_seen:
continue
mail = GmailMessage.from_id(msg_id['id'])
m = regex.match(mail['To'])
@@ -169,4 +169,5 @@ if __name__ == "__main__":
db.commit()
print(msg_id['id'], news_id, email_addr, date, comment)
already_seen.add(msg_id['id'])
- pickle.dump(already_seen, '.pickle')
+ with open('.pickle', 'wb') as fh:
+ pickle.dump(already_seen, fh)