【发布时间】:2019-09-12 11:51:14
【问题描述】:
我需要从 Windows 连接到 Exchange Server(通过 EWS api)并下载带有附件的邮件。所以我创建了下面的脚本。使用 Kerberos 进行身份验证进行交换。 主要问题是:
- 此代码可以使用吗?还是应该使用其他模块进行连接?主要是关于使用 Kerberos 连接到 Exchange 的部分。
- 我需要关注哪些事情,或者我应该先检查一下?
我使用 Exchangelib 连接到 Exchange。问题与 Exchangelib 有关,任何人都像我一样在类似的情况下使用它(从 Windows 通过 Kerberos 连接到 EWS)?
from exchangelib import DELEGATE, Configuration, GSSAPI
from exchangelib.protocol import BaseProtocol, NoVerifyHTTPAdapter
from exchangelib import Account, ServiceAccount
import extract_msg
import logging.handlers
import os
import winkerberos as kerberos
from datetime import datetime
#connecting to Exchange
user='administrator@xy.test'
password='secret!@#'
BaseProtocol.HTTP_ADAPTER_CLS = NoVerifyHTTPAdapter
config = Configuration(
server='172.16.41.206',
credentials = ServiceAccount(username=user, password=password),
auth_type = GSSAPI
)
account = Account(
primary_smtp_address='administrator@xy.test',
autodiscover=False,
config=config,
access_type=DELEGATE)
【问题讨论】:
标签: python exchange-server exchangewebservices kerberos exchangelib