pyexchange
pyexchange copied to clipboard
exchangelib -- workaround found
Last week (week of Aug. 23 or so 2017), my python scripts that use exchangelib stopped working on both Linux Ubuntu and Windows 7 64 bit. I traced the issue to this line:
account = Account(primary_smtp_address='[email protected]', credentials=credentials,autodiscover=True)
Here are the error messages:
EWS https://outlook.office365.com/EWS/Exchange.asmx, account None: Exception in _get_elements: Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/exchangelib/services.py", line 74, in _get_elements response = self._get_response_xml(payload=payload) File "/usr/local/lib/python3.5/dist-packages/exchangelib/services.py", line 161, in _get_response_xml new_version = Version.from_response(requested_api_version=api_version, response=r.text) File "/usr/local/lib/python3.5/dist-packages/exchangelib/version.py", line 248, in from_response api_version_from_server = info.get('Version') or build.api_version() File "/usr/local/lib/python3.5/dist-packages/exchangelib/version.py", line 102, in api_version return self.API_VERSION_MAP[self.major_version][self.minor_version] KeyError: 20
Traceback (most recent call last): File "365debug.py", line 16, in
The problem for me was that the major_version and minor_version returned by the Exchange Server are of 15 and 20 However the minor_version 20 doesn't exists in the version_map of the library. If you want it to work you can hotfix this by setting hardcoded value to not have a key error. The file to modify is located in /usr/local/lib/python3.X/dist-packages/exchangelib/version.py Line 102 I replaced major_version by 15 and minor_version by 1.
Just for the record, this GitHub project is for pyexchange, not exchangelib.