1 #!/usr/bin/python 2 3 import pprint, sys, time 4 import dbus, flimflam 5 6 if (len(sys.argv) < 2): 7 print "Usage: %s <service_name>" % (sys.argv[0]) 8 sys.exit(1) 9 10 flim = flimflam.FlimFlam(dbus.SystemBus()) 11 12 timeout = time.time() + 30 13 while time.time() < timeout: 14 service = flim.FindElementByPropertySubstring('Service', 15 'Name', 16 sys.argv[1]) 17 if service: 18 break 19 time.sleep(.5) 20 21 if service is None: 22 print "Unknown service %s" % sys.argv[1] 23 sys.exit(2) 24 25 (success, diagnostics) = flim.ConnectService(service=service) 26 27 print 'Success:', success 28 pprint.pprint(diagnostics) 29