2014-03-03 15:13:20 +01:00
|
|
|
#!/usr/bin/env python
|
2020-12-23 22:21:36 +01:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
2014-03-03 15:13:20 +01:00
|
|
|
#
|
|
|
|
|
# Copyright (C) 2014 Red Hat, Inc.
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
# This example lists currently active connections
|
|
|
|
|
|
2015-11-11 10:37:07 +01:00
|
|
|
import gi
|
2020-06-09 16:28:32 -04:00
|
|
|
|
|
|
|
|
gi.require_version("NM", "1.0")
|
2020-05-06 23:16:34 +02:00
|
|
|
from gi.repository import NM
|
2014-03-03 15:13:20 +01:00
|
|
|
|
2014-03-03 15:29:10 +01:00
|
|
|
if __name__ == "__main__":
|
2014-05-15 14:25:07 -04:00
|
|
|
client = NM.Client.new(None)
|
2014-03-03 15:13:20 +01:00
|
|
|
acons = client.get_active_connections()
|
|
|
|
|
for ac in acons:
|
2017-12-02 12:44:50 +08:00
|
|
|
print("%s (%s) - %s" % (ac.get_id(), ac.get_uuid(), ac.get_connection_type()))
|
2014-03-03 15:13:20 +01:00
|
|
|
if len(acons) == 0:
|
2020-06-09 16:28:32 -04:00
|
|
|
print("No active connections")
|