How to programmatically get a list of wireless SSIDs in range from NetworkManager
You can do this easily from NetworkManager's pygi bindings:
from gi.repository import NetworkManager, NMClient
nmc = NMClient.Client.new()
devs = nmc.get_devices()
for dev in devs:
if dev.get_device_type() == NetworkManager.DeviceType.WIFI:
for ap in dev.get_access_points():
print ap.get_ssid()
Or from DBus directly, see http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/show-bssids.py
If you're inclined to just quickly script this in shell; an easy way to ask NetworkManager for this is to use:
nmcli dev wifi list
Or use iwlist scan, or better: iw dev wlan0 scan (or ... scan dump), after installing the iw package.
One option is to run iwlist scan
on the command line, but it has to be run as root