Created
March 27, 2019 16:34
-
-
Save GabrielL/975198e81b0d908eda80eafbf52098d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dbus | |
def iwd_stations(obj): | |
for k, v in obj.items(): | |
if 'net.connman.iwd.Station' in v: | |
yield k, v | |
system_bus = dbus.SystemBus() | |
o = system_bus.get_object('net.connman.iwd', '/') | |
objs = o.GetManagedObjects(dbus_interface='org.freedesktop.DBus.ObjectManager') | |
try: | |
for name, station in iwd_stations(objs): | |
print(objs[station['net.connman.iwd.Station']['ConnectedNetwork']]['net.connman.iwd.Network']['Name']) | |
except Exception: | |
print("unknown") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment