Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exchangelib -- workaround found #79

Open
twallace12 opened this issue Aug 27, 2017 · 2 comments
Open

exchangelib -- workaround found #79

twallace12 opened this issue Aug 27, 2017 · 2 comments

Comments

@twallace12
Copy link

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 account = Account(primarysmtp_address='[email protected]', 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

@twallace12 twallace12 changed the title exchangelib exchangelib -- workaround found Aug 29, 2017
@twallace12
Copy link
Author

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.

@ecederstrand
Copy link

Just for the record, this GitHub project is for pyexchange, not exchangelib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants