Open twallace12 opened 6 years ago
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.
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='someone@somewhere.org', 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 account = Account(primarysmtp_address='someone@somewhere.org', credentials=credentials,autodiscover=True) File "/usr/local/lib/python3.5/dist-packages/exchangelib/account.py", line 68, in init_ credentials=credentials, verifyssl=verify_ssl) File "/usr/local/lib/python3.5/dist-packages/exchangelib/autodiscover.py", line 186, in discover protocol=protocol) File "/usr/local/lib/python3.5/dist-packages/exchangelib/autodiscover.py", line 330, in _autodiscover_quick verify_ssl=protocol.verify_ssl) File "/usr/local/lib/python3.5/dist-packages/exchangelib/protocol.py", line 173, in call_ protocol = super(CachingProtocol, cls).call(args, *kwargs) File "/usr/local/lib/python3.5/dist-packages/exchangelib/protocol.py", line 226, in init self.version = Version.guess(self) File "/usr/local/lib/python3.5/dist-packages/exchangelib/version.py", line 194, in guess return cls._guess_version_from_service(protocol=protocol, hint=api_version) File "/usr/local/lib/python3.5/dist-packages/exchangelib/version.py", line 226, in _guess_version_from_service ResolveNames(protocol=protocol).call(unresolved_entries=[protocol.credentials.username]) File "/usr/local/lib/python3.5/dist-packages/exchangelib/services.py", line 975, in call return_full_contact_data=return_full_contact_data, 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