Refactored tools services endpoints system and fixed json formatter. #91

Merged
koleckia merged 12 commits from tools-services into master 2023-03-02 11:49:23 +01:00
Showing only changes of commit 58cc675c5a - Show all commits

View File

@@ -58,6 +58,12 @@ def xpath(source: str, xpath: str) -> str:
nsmap.pop(None)
result = root.xpath(xpath, namespaces=nsmap)
# root.xpath can return 4 types: float, string, bool and list.
# List is the only one that can't be simply converted to str
if result is not list:
return str(result)
else:
result_string = ""
for e in result:
result_string += etree.tostring(e, pretty_print=True).decode() + "\n"