linkedin / pyexchange

Python wrapper for Microsoft Exchange
Apache License 2.0
152 stars 98 forks source link

How can I know what's the problem about connections #68

Open voostar opened 8 years ago

voostar commented 8 years ago

While I try to create an event at start using pyexchange:

AttributeError Traceback (most recent call last)

in () 31 32 # Connect to Exchange and create the event ---> 33 event.create() /usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/**init**.pyc in create(self) 260 body = soap_request.new_event(self) 261 --> 262 response_xml = self.service.send(body) 263 self._id, self._change_key = self._parse_id_and_change_key_from_response(response_xml) 264 /usr/local/lib/python2.7/dist-packages/pyexchange/base/soap.pyc in send(self, xml, headers, retries, timeout, encoding) 32 request_xml = self._wrap_soap_xml_request(xml) 33 log.info(etree.tostring(request_xml, encoding=encoding, pretty_print=True)) ---> 34 response = self._send_soap_request(request_xml, headers=headers, retries=retries, timeout=timeout, encoding=encoding) 35 return self._parse(response, encoding=encoding) 36 /usr/local/lib/python2.7/dist-packages/pyexchange/exchange2010/**init**.pyc in _send_soap_request(self, body, headers, retries, timeout, encoding) 42 "Content-type": "text/xml; charset=%s " % encoding 43 } ---> 44 return super(Exchange2010Service, self)._send_soap_request(body, headers=headers, retries=retries, timeout=timeout, encoding=encoding) 45 46 def _check_for_errors(self, xml_tree): /usr/local/lib/python2.7/dist-packages/pyexchange/base/soap.pyc in _send_soap_request(self, xml, headers, retries, timeout, encoding) 63 body = etree.tostring(xml, encoding=encoding) 64 ---> 65 response = self.connection.send(body, headers, retries, timeout) 66 return response 67 /usr/local/lib/python2.7/dist-packages/pyexchange/connection.pyc in send(self, body, headers, retries, timeout, encoding) 65 response.raise_for_status() 66 except requests.exceptions.RequestException as err: ---> 67 log.debug(err.response.content) 68 raise FailedExchangeException(u'Unable to connect to Exchange: %s' % err) 69 AttributeError: 'NoneType' object has no attribute 'content' It connect to company's exchange server and Lightning is working. So I wondering how can I trouble shooting about the connections?
voostar commented 8 years ago

I found that responses doesn't have content attribute. So why log it at line 67? After I committed line 67 then I got the error message to know the root cause.

fedorareis commented 7 years ago

line 67 should only have err.response. It as response is the content of the error. The .content portion at the end causes an error about the response not having content.