diff options
| author | Michael Biebl <biebl@debian.org> | 2020-06-28 18:58:14 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2020-06-28 18:58:14 +0200 |
| commit | a54ac63bbf9b2c71026ac9028a8ffaf186cf3c82 (patch) | |
| tree | 6a32883bd916c4096357b35298beff6db8bcd0b5 /examples/python/dbus/show-bssids.py | |
| parent | 45e8e1149027529194982212c804c0468aa01d98 (diff) | |
New upstream version 1.25.90 upstream/1.25.90
Diffstat (limited to 'examples/python/dbus/show-bssids.py')
| -rwxr-xr-x | examples/python/dbus/show-bssids.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/examples/python/dbus/show-bssids.py b/examples/python/dbus/show-bssids.py index b4217a55..1e7181fe 100755 --- a/examples/python/dbus/show-bssids.py +++ b/examples/python/dbus/show-bssids.py @@ -14,7 +14,9 @@ import dbus bus = dbus.SystemBus() # Get a proxy for the base NetworkManager object -proxy = bus.get_object("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager") +proxy = bus.get_object( + "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager" +) manager = dbus.Interface(proxy, "org.freedesktop.NetworkManager") all_aps = [] @@ -35,20 +37,26 @@ for d in devices: # Get device's type; we only want wifi devices iface = prop_iface.Get("org.freedesktop.NetworkManager.Device", "Interface") dtype = prop_iface.Get("org.freedesktop.NetworkManager.Device", "DeviceType") - if dtype == 2: # WiFi + if dtype == 2: # WiFi # Get a proxy for the wifi interface - wifi_iface = dbus.Interface(dev_proxy, "org.freedesktop.NetworkManager.Device.Wireless") + wifi_iface = dbus.Interface( + dev_proxy, "org.freedesktop.NetworkManager.Device.Wireless" + ) wifi_prop_iface = dbus.Interface(dev_proxy, "org.freedesktop.DBus.Properties") # Get the associated AP's object path - connected_path = wifi_prop_iface.Get("org.freedesktop.NetworkManager.Device.Wireless", "ActiveAccessPoint") + connected_path = wifi_prop_iface.Get( + "org.freedesktop.NetworkManager.Device.Wireless", "ActiveAccessPoint" + ) # Get all APs the card can see aps = wifi_iface.GetAccessPoints() for path in aps: ap_proxy = bus.get_object("org.freedesktop.NetworkManager", path) ap_prop_iface = dbus.Interface(ap_proxy, "org.freedesktop.DBus.Properties") - bssid = ap_prop_iface.Get("org.freedesktop.NetworkManager.AccessPoint", "HwAddress") + bssid = ap_prop_iface.Get( + "org.freedesktop.NetworkManager.AccessPoint", "HwAddress" + ) # Cache the BSSID if not bssid in all_aps: @@ -62,4 +70,3 @@ for d in devices: print("\nFound APs:") for bssid in all_aps: print(bssid) - |