Rawhide NetworkManager

Nils Philippsen nphilipp at redhat.com
Wed Mar 23 17:32:09 UTC 2005


On Wed, 2005-03-23 at 11:37 -0500, Ray Strode wrote:
> Hi Nils,
> > import dbus
> > 
> > service = 'org.freedesktop.NetworkManager'
> > object_path = "/org/freedesktop/NetworkManager/DhcpOptions"
> > interface = "org.freedesktop.NetworkManager.DhcpOptions"
> > 
> > bus = dbus.Bus (dbus.Bus.TYPE_SYSTEM)
> > NWM_service = bus.get_service (service)
> > dhcpOptions = NWM_service.get_object (object_path, interface)
> > --- >8 ---
> > 
> > but the resulting dhcpOptions options doesn't have many methods to begin
> > with:
> > 
> > dhcpOptions: ['__doc__', '__getattr__', '__init__', '__module__',
> > '_interface', '_object_path', '_service', 'connect_to_signal']
> The python bindings to dbus don't know about methods ahead of time.  You
> just have to call them and see what happens.
> e.g.,
> type = dhcpOptions.getType("NTP Servers")

Hmm, how can I find out what methods a remote object implements -- dir()
obviously doesn't tell me there is getType(), but it worked kind of:

Traceback (most recent call last):
  File "./NetworkManagerTinkerer.py", line 18, in ?
    print dhcpOptions.getType ('NTP Servers')
  File "/usr/lib/python2.3/site-packages/dbus.py", line 208, in __call__
    reply_message = self._connection.send_with_reply_and_block(message,
5000)
  File "dbus_bindings.pyx", line 557, in
dbus_bindings.Connection.send_with_reply_and_block
dbus_bindings.DBusException: The requested DHCP option does not exist.

Thanks,
Nils
-- 
     Nils Philippsen    /    Red Hat    /    nphilipp at redhat.com
"They that can give up essential liberty to obtain a little temporary
 safety deserve neither liberty nor safety."     -- B. Franklin, 1759
 PGP fingerprint:  C4A8 9474 5C4C ADE3 2B8F  656D 47D8 9B65 6951 3011




More information about the fedora-devel-list mailing list