1#!/usr/bin/python 2 3import dbus 4 5bus = dbus.SystemBus() 6 7manager = dbus.Interface(bus.get_object('org.freedesktop.NetworkManager', 8 '/org/freedesktop/NetworkManager'), 9 'org.freedesktop.NetworkManager') 10 11states = [ "unknown", "asleep", "connecting", "connected", "disconnected" ] 12 13state = manager.state() 14 15print "System is %s" % (states[state]) 16