Created
May 4, 2015 20:17
-
-
Save sobelk/aca663b3572acf8de387 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import imaplib | |
import sys | |
from boto.ec2 import cloudwatch | |
email, password, mailbox = sys.argv[1:] | |
imap = imaplib.IMAP4_SSL('imap.gmail.com') | |
imap.login(email, password) | |
status, counts = imap.select(mailbox) | |
count = counts[0] | |
cw = cloudwatch.CloudWatchConnection() | |
cw.put_metric_data( | |
'Team', | |
'InboxCount', | |
value=count, | |
unit='Count', | |
dimensions={ | |
'Email': email | |
}) | |
print email, mailbox, count |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
email=$1 | |
read -s -p "password for $email: " password | |
echo | |
while true | |
do | |
env python tools/inbox_count.py $email "$password" INBOX | |
sleep 50 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment