【问题标题】:imap_tools Response status "ok" expected but "no" received Errorimap_tools 响应状态“正常”预期但“否”收到错误
【发布时间】:2021-07-05 11:32:38
【问题描述】:

我正在尝试从 Yahoo 电子邮件中抓取链接,但不断收到以下错误。我已尝试添加睡眠条件,但似乎没有任何区别。

Response status "ok" expected but "no" received. Data: [b'[SERVERBUG] SELECT Server error - Please try again later']

谁能看出问题出在哪里?

from imap_tools import MailBox, AND
import re, time, datetime, os
from config import email, password

uids = []
yahooSmtpServer = "imap.mail.yahoo.com"
while True:
    while True:
        try:
            client = MailBox(yahooSmtpServer).login(email, password, 'INBOX')
            try:
                msgs = client.fetch(AND(seen=False))
                for msg in msgs:
                    links = []
                    if str(datetime.datetime.today()).split(' ')[0] == str(msg.date).split(' ')[0]:
                    #if str(msg.date).split(' ')[0].split('-')[0] == '2021' and str(msg.date).split(' ')[0].split('-')[1] == '06' and not msg.uid in uids:
                        mail = msg.html
                        #uids.append(msg.uid)
                        if 'order' in mail and not 'return' in mail:
                            for i in re.findall(r'(https?://[^\s]+)', mail):
                                if 'pick' in i:
                                    link = i.replace('"', "")
                                    link = link.replace('<', '>').split('>')[0]
                                    print(link)
                                    os.system('start cmd /c python scrap.py '+ link + ' && exit')
                        
                                    break
                        client.seen(msg.uid, True)
            except Exception as e:
                print(e)
                pass
            client.logout()
            time.sleep(5)
        except Exception as e:
            print(e)
            print('sleeping for 5 sec')
            time.sleep(1)

【问题讨论】:

    标签: python imap-tools


    【解决方案1】:

    您似乎向服务器发送了垃圾邮件。

    【讨论】:

      猜你喜欢
      • 2018-11-26
      • 2021-05-24
      • 2019-03-20
      • 2021-04-02
      • 1970-01-01
      • 2022-07-15
      • 1970-01-01
      • 2019-02-16
      • 1970-01-01
      相关资源
      最近更新 更多