linkedin / linkedin/pyexchange
exchangelib -- workaround found
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 154
- Forks
- 91
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with version.py at API_VERSION_MAP line 102 and Version.from_response around line 248, then trace the response handling through services.py line 161. Reproduce the failure with the Account autodiscover example against the reported Office 365 endpoint; done means the server response no longer raises KeyError 20.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100