2017-03-01 91 views
0

我試圖用exchangelib登錄到exchangeserver。 當我嘗試運行該腳本時,它給了我一個錯誤: 文件「/usr/local/lib/python3.5/dist-packages/exchangelib/protocol.py」,第61行,在init assert isinstance(證書) 聲明錯誤python3 exchangelib憑證

從我所能理解的情況來看,這表示我的憑證variabel不是正確的類型。我已嘗試使用和不使用自動發現功能。我犯了同樣的錯誤。 這裏是相關的代碼。

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

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

    account = Account(
      primary_smtp_address='[email protected]', 
      config=config, 
      autodiscover=True, 
      access_type=DELEGATE) 

回答

0

試試這個方法:

config = Configuration(
        server='mail.example.com', 
        credentials=Credentials(username='Domain\username', password='password'), 
        auth_type=NTLM 
        ) 
account = Account(primary_smtp_address='[email protected]', config=config, 
          access_type=DELEGATE) 
0

這是由於在第一行可怕的Python後面的逗號,其中「有益」將您的credents可變進Credentials元組。