from gi.repository import NMClient

c = NMClient.Client()
for dev in c.get_devices():
    print('----- device %s -----' % dev.props.interface)
    for conn in dev.get_available_connections():
        print('Connection: ', conn.get_path())
        print('Connection type:', type(conn))
        s = conn.get_setting_wireless_security()
        print('wireless-security setting:', s)
        print('wireless-security setting need_secrets:', s.need_secrets())
        print('connection need_secrets:', conn.need_secrets())
