1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-23 21:36:13 +01:00

_private.api: Use an own ElementTree import instead of importing it from core

This commit is contained in:
Daniel Mach 2023-03-03 11:46:41 +01:00
parent 657e89b5a4
commit 8fb243e897

View File

@ -4,6 +4,9 @@ and work with related XML data.
""" """
from xml.etree import ElementTree as ET
def get(apiurl, path, query=None): def get(apiurl, path, query=None):
""" """
Send a GET request to OBS. Send a GET request to OBS.
@ -28,7 +31,7 @@ def get(apiurl, path, query=None):
url = osc_core.makeurl(apiurl, path, query) url = osc_core.makeurl(apiurl, path, query)
with osc_connection.http_GET(url) as f: with osc_connection.http_GET(url) as f:
root = osc_core.ET.parse(f).getroot() root = ET.parse(f).getroot()
return root return root
@ -56,7 +59,7 @@ def post(apiurl, path, query=None):
url = osc_core.makeurl(apiurl, path, query) url = osc_core.makeurl(apiurl, path, query)
with osc_connection.http_POST(url) as f: with osc_connection.http_POST(url) as f:
root = osc_core.ET.parse(f).getroot() root = ET.parse(f).getroot()
return root return root
@ -116,4 +119,4 @@ def write_xml_node_to_file(node, path, indent=True):
if indent: if indent:
osc_core.xmlindent(node) osc_core.xmlindent(node)
osc_core.ET.ElementTree(node).write(path) ET.ElementTree(node).write(path)