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

line 67 in connection.py unhandled exception #38

Open
jkottapa opened this issue Feb 2, 2015 · 6 comments
Open

line 67 in connection.py unhandled exception #38

jkottapa opened this issue Feb 2, 2015 · 6 comments
Assignees

Comments

@jkottapa
Copy link

jkottapa commented Feb 2, 2015

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.

@catermelon
Copy link
Contributor

Sorry about that - let me take a look.

@solderluke
Copy link

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.

@catermelon
Copy link
Contributor

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.

@catermelon
Copy link
Contributor

(pull requests gladly received btw)

@deronnax
Copy link

#42 :)

@catermelon
Copy link
Contributor

yay! 🎉 I commented on the other one.

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

4 participants