Beispiel #1
0
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
Beispiel #2
0
def getEthernetLink(interface):
    ethernet_object = NetworkInterface(interface)
    return ethernet_object.getLink()