Skip to content

Instantly share code, notes, and snippets.

@mitchtech
Created June 29, 2012 02:52
Show Gist options
  • Save mitchtech/3015384 to your computer and use it in GitHub Desktop.
Save mitchtech/3015384 to your computer and use it in GitHub Desktop.
import RPi.GPIO as GPIO, feedparser
USERNAME="username@gmail.com"
PASSWORD="password"
GPIO_PIN=12
GPIO.setmode(GPIO.BOARD)
GPIO.setup(GPIO_PIN, GPIO.OUT)
newmails = int(feedparser.parse("https://" + USERNAME + ":" + PASSWORD + "@mail.google.com/gmail/feed/atom")["feed"]["fullcount"])
if newmails > 0:
GPIO.output(GPIO_PIN, True)
else:
GPIO.output(GPIO_PIN, False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment