summaryrefslogtreecommitdiff
path: root/examples/python/dbus/vpn.py
diff options
context:
space:
mode:
authorSayed Shah <sayshah@redhat.com>2020-06-30 16:21:00 -0400
committerThomas Haller <thaller@redhat.com>2020-08-03 18:37:43 +0200
commit7baf615eaa27ec38755fcaaf7430b0075087dc60 (patch)
tree524562bcb734e024dc4161e46c9b92f5ed025e37 /examples/python/dbus/vpn.py
parent4d878d7012cd9dc031682ef5e5b025081427325b (diff)
downloadNetworkManager-7baf615eaa27ec38755fcaaf7430b0075087dc60.tar.gz
all: changes from python 2 syntax to python3 and removing dead code
There were python 2 methods that are not used anymore so now it's in python 3. Added helper fuctions so that the code is more clear https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/540
Diffstat (limited to 'examples/python/dbus/vpn.py')
-rwxr-xr-xexamples/python/dbus/vpn.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/examples/python/dbus/vpn.py b/examples/python/dbus/vpn.py
index ed38137280..814e4415d1 100755
--- a/examples/python/dbus/vpn.py
+++ b/examples/python/dbus/vpn.py
@@ -8,17 +8,15 @@
# Run this script without any arguments to list the available connection uuids.
# The uuid of the connection to activate
-CONNECTION_UUID = "ac6dc9b2-85ef-4311-83d8-add5d7db3f59"
+CONNECTION_UUID = "c08142a4-00d9-45bd-a3b1-7610fe146374"
# UID to use. Note that NM only allows the owner of the connection to activate it.
# UID=1000
UID = 0
-import sys
-import os
-import dbus
+import sys, os, dbus
from dbus.mainloop.glib import DBusGMainLoop
-import gobject
+from gi.repository import GLib
DBusGMainLoop(set_as_default=True)
@@ -156,5 +154,5 @@ if get_active_connection_path(CONNECTION_UUID):
print("Activating connection...")
activate_connection(connection_path, device_path)
-loop = gobject.MainLoop()
+loop = GLib.MainLoop()
loop.run()