-
-
Save dirkakrid/af49ee210927d1cd38706fb00436c979 to your computer and use it in GitHub Desktop.
Spam
This file contains hidden or 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 python2.7 | |
# Cuenta correos en spam | |
# | |
# Debe instalar 'pygmail': | |
# pip install pygmail | |
import gmail | |
import logging | |
# logger | |
logger = logging.getLogger('bob') | |
hdlr = logging.FileHandler('bob.log') | |
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') | |
hdlr.setFormatter(formatter) | |
logger.addHandler(hdlr) | |
logger.setLevel(logging.INFO) | |
def main(username='spam', password='nospam'): | |
''' | |
Me autentico a Gmail para contar correos en spam y busco solo | |
no-leidos | |
''' | |
g = gmail.login(username, password) | |
emails = g.mailbox('[Gmail]/Spam').mail(unread=True) | |
print("Correos en spam {}".format(len(emails))) | |
logger.info('Correos en spam %s' % (len(emails))) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment