11#!/usr/bin/env python
2+ from __future__ import absolute_import , division , print_function , unicode_literals
23
34""" Example of browsing for a service (in this case, HTTP) """
45
1011class MyListener (object ):
1112
1213 def removeService (self , zeroconf , type , name ):
13- print ()
1414 print ("Service %s removed" % (name ,))
15+ print ('\n ' )
1516
1617 def addService (self , zeroconf , type , name ):
17- print ()
1818 print ("Service %s added" % (name ,))
1919 print (" Type is %s" % (type ,))
2020 info = zeroconf .getServiceInfo (type , name )
@@ -29,14 +29,16 @@ def addService(self, zeroconf, type, name):
2929 print (" Properties are" )
3030 for key , value in prop .items ():
3131 print (" %s: %s" % (key , value ))
32+ else :
33+ print (" No info" )
34+ print ('\n ' )
3235
3336if __name__ == '__main__' :
34- print ("Multicast DNS Service Discovery for Python Browser test" )
3537 zeroconf = Zeroconf ()
36- print ("Testing browsing for a service ..." )
38+ print ("Browsing services ..." )
3739 listener = MyListener ()
3840 browser = ServiceBrowser (zeroconf , "_http._tcp.local." , listener )
3941 try :
40- raw_input ("Waiting (press Enter to exit)..." )
42+ raw_input ("Waiting (press Enter to exit)...\n \n " )
4143 finally :
4244 zeroconf .close ()
0 commit comments