- 需求
需要爬取当天exchange邮件主题内容
import urllib3, datetime
from exchangelib import DELEGATE, Account, Credentials, BaseProtocol, NoVerifyHTTPAdapter
def reade():
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
BaseProtocol.HTTP_ADAPTER_CLS = NoVerifyHTTPAdapter
creds = Credentials('[email protected]', 'password')
account = Account('primary_smtp_address', credentials=creds, autodiscover=True, access_type=DELEGATE)
return [[i.subject for i in item.all().order_by('-datetime_received')[:66] if str(i.datetime_received).split()[0].replace('-','') == now] for item in account.inbox.children if item.name == '文件夹名']
now = datetime.datetime.now().strftime('%Y%m%d')
[print(i) for i in reade()[0]]
本文由 peiy 创作,采用 知识共享署名4.0 国际许可协议进行许可
本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名
最后编辑时间为: Jan 5, 2022 at 01:46 pm