Check unread count of Gmail messages with Python

后端 未结 7 1422
面向向阳花
面向向阳花 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:04

    Once you are logged in (do this manually or with gmail.py) you should use the feed.

    It is located here: http://mail.google.com/mail/feed/atom

    It is the way Google does it. Here is a link to their js chrome extension: http://dev.chromium.org/developers/design-documents/extensions/samples/gmail.zip

    You will then be able to parse xml that looks like this:

    
    
    Gmail - Inbox for yourmail@gmail.com
    New messages in your Gmail Inbox
    142
    

提交回复
热议问题