23maverick23/oaxmlapi

Error converting request to string

23maverick23 opened this issue · 1 comments

Need to review line 302 in connections.Request().tostring()

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "oaxmlapi/connections.py", line 302, in tostring
    return header + ET.tostring(self.request(), 'utf-8')
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1121, in tostring
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 812, in write
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 871, in _namespaces
AttributeError: 'str' object has no attribute 'getiterator'

I don't believe this is a bug. I think the correct usage of the feature is to pass an object. Instead, a class instance was being passed. The correct usage should look like this:

xml_req = connections.Request(app, auth, xml_data).request().tostring()