def get_appliances():
"""
This will download an archive of all GNS3 appliances and load them to a dictionnary
"""
appliances = {}
url = 'https://github.com/GNS3/gns3-registry/archive/master.zip'
response = urllib.request.urlopen(url)
z = zipfile.ZipFile(io.BytesIO(response.read()))
for path in z.namelist():
if path.endswith('.gns3a'):
with z.open(path, 'r') as f:
id = os.path.basename(path).split('.')[0]
appliance = json.loads(f.read().decode())
if appliance["status"] != "broken":
appliances[id] = appliance
return appliances
评论列表
文章目录