def getEthernetLinkStatus(request): EthernetObject = NetworkInterface() records = [] for iface in EthernetObject.List(): eachEthernetObjects = NetworkInterface(iface.name) records.append({ "Name": iface.name, "Link": eachEthernetObjects.getLink() }) data = json.dumps(records) response = HttpResponse() response['Content-Type'] = "application/json" response.write(data) return response
def getEthernetLink(interface): ethernet_object = NetworkInterface(interface) return ethernet_object.getLink()