簡體   English   中英

imap_tools 預期響應狀態為“ok”但收到“no”錯誤

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

我試圖從雅虎電子郵件中抓取鏈接,但不斷收到以下錯誤。 我試過添加睡眠條件,但似乎沒有任何區別。

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)

看起來你已經向服務器發送了垃圾郵件。

有沒有辦法阻止這個腳本停止? 已經檢查了我郵箱中的設置並添加了所有第三方訪問權限。

似乎沒有幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM