Beispiel #1
0
 def get_priority_params_from_html(etroot: lxml.etree) -> dict:
     keys = []
     values = []
     for child in etroot.iter('input'):
         try:
             keys.append(child.attrib['name'])
             values.append(child.attrib['value'])
         except:
             pass
     d = dict(zip(keys, values))
     return d
Beispiel #2
0
    def get_value_from_xml(etroot: lxml.etree) -> dict:
        """
        get keys and values as array object from lxml.etree object
        :param etroot:lxml.etree object
        :return name, values: both are array object.
        """
        keys = []
        values = []
        for child in etroot.iter('parameter'):
            keys.append(child.find('name').text)
            values.append(child.find('value').text)

        detach_prefix_keys = [helpers.detach_prefix(k) for k in keys]
        data = dict(zip(detach_prefix_keys, values))
        return data
Beispiel #3
0
async def xml2obj(xml: etree) -> List[Article]:
    return [
        sys.modules['pyrssaio.models'].Article(item)
        for item in xml.iter('item')
    ]