NM api from python

Hi all

This question might also interest Brian Millett with his very recent thread about the NM api.

I'm currently writing a python/glade interface to NM to try a different approach for the GUI. (I'm not 100% sure a notification icon is the best way to go, so I want to try something else before complaining :))

For the NM dbus api, I found this on the web

I'm not sure if it's either too old or too new (I use NM-0.5.1) but not all the info in there is correct. Having this kind of document either in CVS or on a website (found it through google ...) is clearly a good idea.

Now I'm having some issues with dbus in python


        self.bus = dbus.SystemBus()
self.NetworkManager_obj = self.bus.get_object( 'org.freedesktop.NetworkManager', '/org/freedesktop/NetworkManager') self.NetworkManager = dbus.Interface(self.NetworkManager_obj, 'org.freedesktop.NetworkManager')

        self.Devices = []
        for device_path in self.NetworkManager.getDevices():
self.Devices.append( dbus.Interface( self.bus.get_object( 'org.freedesktop.NetworkManager', device_path), 'org.freedesktop.NetworkManager.Devices'))


        for device in self.Devices:
            print "<device>"
            print "\t getName() : " , device.getName()
            print "</device>"


The problem I have is that it will read the correct values for the first device (eth0) and then it'll take about 30 seconds to read the values from the second device (eth1). I added self.Devices.reverse() to try a different device first, but to no avail.

So I'm not sure whether it's a dbus/python or NM issue.

Any help would be greatly appreciated.



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