summary refs log tree commit diff
path: root/examples/python/dbus/add-wifi-eap-connection.py
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2020-06-28 18:58:14 +0200
committerMichael Biebl <biebl@debian.org>2020-06-28 18:58:14 +0200
commita54ac63bbf9b2c71026ac9028a8ffaf186cf3c82 (patch)
tree6a32883bd916c4096357b35298beff6db8bcd0b5 /examples/python/dbus/add-wifi-eap-connection.py
parent45e8e1149027529194982212c804c0468aa01d98 (diff)
New upstream version 1.25.90 upstream/1.25.90
Diffstat (limited to 'examples/python/dbus/add-wifi-eap-connection.py')
-rwxr-xr-xexamples/python/dbus/add-wifi-eap-connection.py80
1 files changed, 46 insertions, 34 deletions
diff --git a/examples/python/dbus/add-wifi-eap-connection.py b/examples/python/dbus/add-wifi-eap-connection.py
index 26111138..0386084d 100755
--- a/examples/python/dbus/add-wifi-eap-connection.py
+++ b/examples/python/dbus/add-wifi-eap-connection.py
@@ -6,45 +6,57 @@
 
 import dbus, uuid
 
-def path_to_value(path):
-    return dbus.ByteArray("file://".encode("utf-8") + path.encode("utf-8") + "\0".encode("utf-8"))
-
-s_con = dbus.Dictionary({
-    'type': '802-11-wireless',
-    'uuid': str(uuid.uuid4()),
-    'id': 'My Wifi'})
-
-s_wifi = dbus.Dictionary({
-    'ssid': dbus.ByteArray("homewifi".encode("utf-8")),
-    'security': '802-11-wireless-security'})
-
-s_wsec = dbus.Dictionary({'key-mgmt': 'wpa-eap'})
 
-s_8021x = dbus.Dictionary({
-    'eap': ['tls'],
-    'identity': 'Bill Smith',
-    'client-cert': path_to_value("/some/place/client.pem"),
-    'ca-cert': path_to_value("/some/place/ca-cert.pem"),
-    'private-key': path_to_value("/some/place/privkey.pem"),
-    'private-key-password': "12345testing"})
-
-s_ip4 = dbus.Dictionary({'method': 'auto'})
-s_ip6 = dbus.Dictionary({'method': 'ignore'})
-
-con = dbus.Dictionary({
-    'connection': s_con,
-    '802-11-wireless': s_wifi,
-    '802-11-wireless-security': s_wsec,
-    '802-1x': s_8021x,
-    'ipv4': s_ip4,
-    'ipv6': s_ip6
-     })
+def path_to_value(path):
+    return dbus.ByteArray(
+        "file://".encode("utf-8") + path.encode("utf-8") + "\0".encode("utf-8")
+    )
+
+
+s_con = dbus.Dictionary(
+    {"type": "802-11-wireless", "uuid": str(uuid.uuid4()), "id": "My Wifi"}
+)
+
+s_wifi = dbus.Dictionary(
+    {
+        "ssid": dbus.ByteArray("homewifi".encode("utf-8")),
+        "security": "802-11-wireless-security",
+    }
+)
+
+s_wsec = dbus.Dictionary({"key-mgmt": "wpa-eap"})
+
+s_8021x = dbus.Dictionary(
+    {
+        "eap": ["tls"],
+        "identity": "Bill Smith",
+        "client-cert": path_to_value("/some/place/client.pem"),
+        "ca-cert": path_to_value("/some/place/ca-cert.pem"),
+        "private-key": path_to_value("/some/place/privkey.pem"),
+        "private-key-password": "12345testing",
+    }
+)
+
+s_ip4 = dbus.Dictionary({"method": "auto"})
+s_ip6 = dbus.Dictionary({"method": "ignore"})
+
+con = dbus.Dictionary(
+    {
+        "connection": s_con,
+        "802-11-wireless": s_wifi,
+        "802-11-wireless-security": s_wsec,
+        "802-1x": s_8021x,
+        "ipv4": s_ip4,
+        "ipv6": s_ip6,
+    }
+)
 
 
 bus = dbus.SystemBus()
 
-proxy = bus.get_object("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/Settings")
+proxy = bus.get_object(
+    "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/Settings"
+)
 settings = dbus.Interface(proxy, "org.freedesktop.NetworkManager.Settings")
 
 settings.AddConnection(con)
-