当前位置: 首页>>代码示例>>Python>>正文


Python Gmail.get_unread方法代码示例

本文整理汇总了Python中gmail.Gmail.get_unread方法的典型用法代码示例。如果您正苦于以下问题:Python Gmail.get_unread方法的具体用法?Python Gmail.get_unread怎么用?Python Gmail.get_unread使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gmail.Gmail的用法示例。


在下文中一共展示了Gmail.get_unread方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Gmail

# 需要导入模块: from gmail import Gmail [as 别名]
# 或者: from gmail.Gmail import get_unread [as 别名]
if plex:
    downloaded_movies_location = filebot_location

print_length = 50
new_movies_location = downloaded_movies_location
old_downloaded = os.listdir(downloaded_movies_location)

gmail = Gmail(email_address)
gmail.login_yagmail()

while True:
    current_time = datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d %H:%M:%S')
    print("Checking for emails" + " "*(print_length-(len("Checking for emails"))), end="\r")

    for received_email in gmail.get_unread():
        print("Email received" + " "*(print_length-(len("Email received"))))
        sender = received_email['From']
        subject = received_email['Subject']

        if any(email in sender for email in users):
            added_torrent = find_torrent.search_and_download(subject)

            print(" "*print_length)
            print(sender + " "*(print_length-(len(sender))))
            print(subject + " "*(print_length-(len(subject))))

            gmail.send_email(receivers=users, subject="Movie Received. Downloading.",
                             message="Added movie name: " + added_torrent[0] +
                                     "\nServer output: " + str(added_torrent[1]))
开发者ID:Exaphis,项目名称:KickassMovies,代码行数:31,代码来源:KickassMovies.py


注:本文中的gmail.Gmail.get_unread方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。