pyexchange
pyexchange copied to clipboard
line 67 in connection.py unhandled exception
The try-catch block has a unhandled exception in the catch statement in line 67. This happens when we pass a url that is of type 'https' but it does not have a valid certificate certified by a CA.
This throws the following exception:
>>> c.list_events(start=start_xchange, end=end_exchange, details=True) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 95, in list_events return Exchange2010CalendarEventList(service=self.service, start=start, end=end, details=details) File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 113, in __init__ response_xml = self.service.send(body) File "/usr/local/lib/python2.7/dist-packages/pyexchange/base/soap.py", line 34, in send response = self._send_soap_request(request_xml, headers=headers, retries=retries, timeout=timeout, encoding=encoding) File "/usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/__init__.py", line 44, in _send_soap_request return super(Exchange2010Service, self)._send_soap_request(body, headers=headers, retries=retries, timeout=timeout, encoding=encoding) File "/usr/local/lib/python2.7/dist-packages/pyexchange/base/soap.py", line 65, in _send_soap_request response = self.connection.send(body, headers, retries, timeout) File "/usr/local/lib/python2.7/dist-packages/pyexchange/connection.py", line 67, in send log.debug(err.response.content) AttributeError: 'NoneType' object has no attribute 'content'
This is thrown because of _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
in the requests (line 64) has verify=True set by default. Turning that flag off does everything normally.
Sorry about that - let me take a look.
verify=False in the requests.post in connection.py is a hack but works for me for now.
Better is the option for adding args to include using certs like adding to the requests.post args: "verify=ca_crt, cert=(cert_pem,key_pem)" or if desired "verify=False" I guess.
Yeah, that's a great idea. I'm sorry I haven't had much time to work on this lately, but I should have time this week.
(pull requests gladly received btw)
https://github.com/linkedin/pyexchange/pull/42 :)
yay! :tada: I commented on the other one.