2
0
mirror of https://github.com/narkoz/hacker-scripts synced 2025-08-23 19:07:33 +00:00
hacker-scripts/python/kumar_asshole.py

23 lines
526 B
Python
Raw Normal View History

2015-11-23 22:33:30 +03:00
#!/usr/bin/env python
import gmail
import sys
import re
GMAIL_USERNAME = ENV['GMAIL_USERNAME']
GMAIL_PASSWORD = ENV['GMAIL_PASSWORD']
g = gmail.login(GMAIL_USERNAME, GMAIL_PASSWORD)
if not g.logged_in:
sys.exit()
msgs = g.inbox().mail(sender="kumar.a@example.com", unread=True)
pattern = re.compile("\bsorry\b | \bhelp\b | \bwrong\b ", flags=re.I)
for msg in msgs:
if pattern.match(msg.body):
msg.label("Database fixes")
msg.reply("No problem. I've fixed it. \n\n Please be careful next time.")