I am getting the XML data in below format
<?xml version="1.0"?>
<localPluginManager>
<plugin>
<longName>Plugin Usage - Plugin</longName>
<pinned>false</pinned>
<shortName>plugin-usage-plugin</shortName>
<version>0.3</version>
</plugin>
<plugin>
<longName>Matrix Project Plugin</longName>
<pinned>false</pinned>
<shortName>matrix-project</shortName>
<version>4.5</version>
</plugin>
</localPluginManager>
Used below program to fetch the "longName"
and "version"
from the XML
import xml.etree.ElementTree as ET
import requests
import sys
response = requests.get(<url1>,stream=True)
response.raw.decode_content = True
tree = ET.parse(response.raw)
root = tree.getroot()
for plugin in root.findall('plugin'):
longName = plugin.find('longName').text
shortName = plugin.find('shortName').text
version = plugin.find('version').text
master01 = longName, version
print (master01,version)
Which gives me below output which I want to convert in dictionary format to process further
('Plugin Usage - Plugin', '0.3')
('Matrix Project Plugin', '4.5')
Expected Output -
dictionary = {"Plugin Usage - Plugin": "0.3", "Matrix Project Plugin": "4.5"}