Ok, I figured it out by myself. No keyring needed, just the right properties. In most of the examples I have found the password is is loaded into 'wpa-key'. This is is not correct, at least it does not work in Ubuntu 11.10. The correct property is psk. I would love to find some more detailed documentation for this. It is a bit too hard. Below code works. s_con = { 'id': 'XXX', 'uuid': '5ef2d781-1197-44eb-8744-cd78b9c07315', 'type': '802-11-wireless', 'autoconnect': False, 'name': 'connection' } s_wifi = { 'ssid': dbus.ByteArray("XXX"), 'mode': 'infrastructure', 'security': '802-11-wireless-security', 'name': '802-11-wireless' } s_wsec = { 'key-mgmt': 'wpa-psk', 'psk': 'xxx', 'name': '802-11-wireless-security' } s_ip4 = { 'method': 'auto', 'name': 'ipv4' } con = { 'connection': s_con, '802-11-wireless': s_wifi, '802-11-wireless-security': s_wsec, 'ipv4': s_ip4 } > Subject: Re: Help with adding wifi connections with python > From: awilliam whitemice org > To: networkmanager-list gnome org > Date: Mon, 20 Feb 2012 08:27:30 -0500 > > On Sun, 2012-02-19 at 11:02 +0000, Jonas Vikstrom wrote: > > Hello, > > I am trying to move from wicd to network-manager and from a python > > point of view it is not easy. > > I have found a number of libraries but non of them works with Ubuntu > > 11.10 (nm 0.9). > > (the project is wireless manager for xbmc) > > These examples are great > > http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python > > But do not cover more then one example of security setup. > > I have reviewed the code for nmcli but it does not cover create > > connections. > > I am now pretty close by using this example from this list > > http://osdir.com/ml/networkmanager-list/2010-07/msg00107.html > > It exectutes fine with sudo but the password is not set. I have no > > clue how to find more information and I really need some examples. > > s_con = { 'id': 'XXX', 'uuid': '5ef2d781-1197-44eb-8744-cd78b9c07315', > > 'type': '802-11-wireless', 'autoconnect': False, 'name': > > 'connection' } > > s_wifi = { 'ssid': dbus.ByteArray("XXX"), 'mode': 'infrastructure', > > 'security': '802-11-wireless-security', 'name': '802-11-wireless' } > > s_wsec = { 'key-mgmt': 'wpa-psk', 'wpa-key': 'xxx', 'name': > > '802-11-wireless-security' } > > s_ip4 = { 'method': 'auto', 'name': 'ipv4' } > > con = { 'connection': s_con, '802-11-wireless': s_wifi, > > '802-11-wireless-security': s_wsec, 'ipv4': s_ip4 } > > Is the password set by NetworkManager or does NetworkManager use the > GNOME keyring for the passwords? > > I don't know, but I'd check that out. > > > This is how far I am nowbefore adding functionality to create > > connections. > > http://dl.dropbox.com/u/17892827/xbmc/vikjon0-py-nm.py > > http://forum.xbmc.org/showthread.php?t=119592 > > > -- > System & Network Administrator [ LPI & NCLA ] > <http://www.whitemiceconsulting.com> > OpenGroupware Developer <http://www.opengroupware.us> > Adam Tauno Williams > > _______________________________________________ > networkmanager-list mailing list > networkmanager-list gnome org > http://mail.gnome.org/mailman/listinfo/networkmanager-list |