简体   繁体   English

imap_tools 预期响应状态为“ok”但收到“no”错误

[英]imap_tools Response status "ok" expected but "no" received Error

I am trying to scrape links from Yahoo emails but keep getting the following error.我试图从雅虎电子邮件中抓取链接,但不断收到以下错误。 I have tried adding a sleep condition but it does not seem to have made any difference.我试过添加睡眠条件,但似乎没有任何区别。

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

Can anyone see what the issue is?任何人都可以看到问题是什么吗?

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)

It looks like you have spammed the server.看起来你已经向服务器发送了垃圾邮件。

Is there a way to prevent this from stopping the script?有没有办法阻止这个脚本停止? Already checked the settings from my mailbox and added all third-party access.已经检查了我邮箱中的设置并添加了所有第三方访问权限。

Didn't seem to help tho.似乎没有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM