Skip to main content
 首页 » 编程设计

Python Exchangelib 连接问题,keyError 20

2025年02月15日8JustinYoung

我正在尝试使用 python 3.6 和 exchangelib 连接到 office365 exchange 帐户 - 但出现错误:

exchangelib\version.py",第 102 行,在 api_version 中 返回 self.API_VERSION_MAP[self.major_version][self.minor_version]

按键错误:20

我只是在执行连接代码的最简单版本,但指定配置而不是自动发现也不起作用:

      credentials = Credentials(username=<login>, password=<password>)     
      self.__account = Account(primary_smtp_address=mailbox,  
                               credentials=credentials, 
                               autodiscover=True, access_type=DELEGATE) 

这可能是什么问题?

请您参考如下方法:

这是由于来自 EWS 的意外内部版本号。固定在 https://github.com/ecederstrand/exchangelib/issues/221