How can I check the number of unread Gmail message in my inbox with a short Python script? Bonus points for retrieving the password from a file.
I advise you to use Gmail atom feed
It is as simple as this:
import urllib url = 'https://mail.google.com/mail/feed/atom/' opener = urllib.FancyURLopener() f = opener.open(url) feed = f.read()
You can then use the feed parse function in this nice article: Check Gmail the pythonic way