Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
CDJellen committed Aug 28, 2024
1 parent 94c6174 commit 1b729e6
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions ndbc_api/api/parsers/_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,9 @@ def root_from_response(cls, response: dict) -> ET.ElementTree:
"""

body = response.get('body')
cleaned_body = body.replace('\n', '').strip()
cleaned_body = cleaned_body.replace('<?xml version="1.0" encoding="UTF-8"?>', '')
cleaned_body = re.sub('', '', cleaned_body)

try:
root = ET.fromstring(cleaned_body)
root = ET.fromstring(body)
return ET.ElementTree(root)
except Exception as e:
raise ParserException("failed to obtain XML root from response body") from e

return root

0 comments on commit 1b729e6

Please sign in to comment.