RE: Help with adding wifi connections with python



Hello,Send

I have finally manage to get all the needed wifi operations to work in python. 
If anyone needs it you find it here https://github.com/vikjon0/qfpynm
I think it is more complete than anything else available. List, add, delete, update, deactivate, activate, etc.

It works pretty good but I have perhaps found a small exception I will describe it in a separate email.
There are a few things missing but it is close to completion and usable as is.

best regards, Jonas




From: jonas_vikstrom hotmail com
To: networkmanager-list gnome org
Subject: RE: Help with adding wifi connections with python
Date: Sat, 25 Feb 2012 10:11:59 +0000

Yes, of course I will share..
I made a new example for the nm project. If someone that is hooked up could submit it I would be thankful.
http://dl.dropbox.com/u/17892827/add-system-wifi-connection-wpa.py

Another python example for translating the flags to wep, wpa, wpa2 would be very nice as well.
It will try to rip it out if nmcli but if someone beats me to it...would be nice :)

My project is here
https://github.com/vikjon0/xbmc.script.linux.nm/tree/master/resources/lib

If this example is included I will try to make more as I go along.

best regards, Jonas

> Subject: RE: Help with adding wifi connections with python
> From: awilliam whitemice org
> To: networkmanager-list gnome org
> Date: Tue, 21 Feb 2012 15:20:41 -0500
>
> On Tue, 2012-02-21 at 20:19 +0000, Jonas Vikstrom wrote:
>
> > Ok, I figured it out by myself. No keyring needed, just the right
> > properties.
>
> Awesome. And this would make a really great example for a BLOG post!
> Hint, hint, nudge, nudge.
>
> > 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.
> > 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]