0

我正在尝试使用exchangelib 登录到exchangeserver。当我尝试运行脚本时,它给了我一个错误:文件“/usr/local/lib/python3.5/dist-packages/exchangelib/protocol.py”,第 61 行,在init assert isinstance(credentials, Credentials) AssertionError

据我所知,它说我的凭证变量类型不正确。我已经尝试过启用和不启用自动发现。我犯了同样的错误。这是相关的代码。

credents = Credentials(username='domain\\aaa.fh', password= 'password'), 

  config = Configuration(server='domain.aaa.no', credentials= credents)

  account = Account(
          primary_smtp_address='fh@domain.no',
          config=config,
          autodiscover=True,
          access_type=DELEGATE)
4

2 回答 2

0

试试这个方法:

config = Configuration(
                    server='mail.example.com',
                    credentials=Credentials(username='Domain\username', password='password'),
                    auth_type=NTLM
                    )
account = Account(primary_smtp_address='Emailaddress@domain.com', config=config,
                           access_type=DELEGATE)
于 2017-07-06T12:33:05.560 回答
0

这是由于第一行中可怕的 Python 尾随逗号,它“有帮助”将您的credents变量转换为Credentials.

于 2017-07-10T21:47:09.737 回答