rtcclient icon indicating copy to clipboard operation
rtcclient copied to clipboard

Disable xmltodict.parse for File Contents/non-XML-responses?

Open Mershl opened this issue 8 years ago • 5 comments

utils.py:29 is raising an ExpatError for correct content retrieved by fetchBeforeStateFile (of a Change).

  File "[...]rtcclient\models.py", line 248, in fetchBeforeStateFile
    return self._fetchFile(self.before, file_folder, override=False)
  File "[...]rtcclient\models.py", line 298, in _fetchFile
    headers=self.rtc_obj.headers)
  File "[...]rtcclient\utils.py", line 44, in wrapper
    raise ExpatError(excp)
xml.parsers.expat.ExpatError: syntax error: line 1, column 0

Mershl avatar Jun 30 '17 09:06 Mershl

@Mershl I think the exception is about the token. That function in the decorator is mainly for relogin when the token gets expired.

dixudx avatar Jun 30 '17 09:06 dixudx

@dixudx Debugging this issue shows that the parsed resp.content is the File Content of fetchBeforeStateFile (containing source code only), not an xml/token response.

Mershl avatar Jun 30 '17 09:06 Mershl

@Mershl Yeah, I understand what you mean. Would you please submit a PR fixing this? Thanks.

dixudx avatar Jun 30 '17 09:06 dixudx

@dixudx I'll try to find a lean solution for this. For now I'm skipping the check in my local project.

Mershl avatar Aug 02 '17 15:08 Mershl

@Mershl For my problem, just comment # xmltodict.parse (resp.content) in utils.py. I just need to get the file name using fetchBeforeStateFile without get file, this solution works for me.

raphaelkrauss avatar Aug 21 '17 18:08 raphaelkrauss