免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2632 | 回复: 0
打印 上一主题 下一主题

一段取Gmail的脚本 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-02-02 20:28 |只看该作者 |倒序浏览
#!/usr/bin/env python
# -*- coding: GB2312 -*-
"""Check new mails at gmail.com
add this line to cron, using 'crontab -e':
*/20 * * * * /home/xyb/bin/checkgmail.py 2> /dev/null
"""
__revision__ = '0.1'
import sys
sys.path.append('/home/xyb/py/')
def loop():
    import time
    from gmail import GmailClient
    c = GmailClient()
    c.login('account','passport')
    while True:
        print time.asctime(), len(c.get_inbox_conversations(is_unread=True))
        time.sleep(60)
def scan():
    import time
    from gmail import GmailClient
    all=(('account1','passport1'),('account2','passport2'),)
    for u,p in all:
        c = GmailClient()
        c.login(u,p)
        new=len(c.get_inbox_conversations(is_unread=True))
        if new:
            print time.asctime(), u+'@gmail.com', new
        del c
def main():
    import sys
    if len(sys.argv)==1:
        scan()
if '__main__'==__name__:
    main()
还有人写了把yahoo、outlook之类的邮件系统中的联系人转到gmail里的脚本。
最近,有人发布了libgmail:
href=http://sourceforge.net/projects/libgmail/>http://sourceforge.net/projects/libgmai
l/
不知道用起来怎么样。


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/13533/showart_71519.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP