Check unread count of Gmail messages with Python

后端 未结 7 1357
面向向阳花
面向向阳花 2020-12-22 17:41

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.

相关标签:
7条回答
  • 2020-12-22 18:24

    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

    0 讨论(0)
提交回复
热议问题