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