@@ -56,28 +56,28 @@ How do I use it?
56
56
57
57
Here's an example:
58
58
59
- `` ` python
60
- from zeroconf import raw_input, ServiceBrowser, Zeroconf
61
-
62
-
63
- class MyListener(object):
64
-
65
- def removeService(self, zeroconf, type, name):
66
- print("Service %s removed" % ( name,))
67
-
68
- def addService(self, zeroconf, type, name):
69
- info = zeroconf.getServiceInfo( type, name)
70
- print("Service %s added, service info: %s" % (name, info) )
71
-
72
-
73
- zeroconf = Zeroconf()
74
- listener = MyListener ()
75
- browser = ServiceBrowser(zeroconf, "_http._tcp.local.", listener)
76
- try:
77
- raw_input("Press enter to exit...\n\n")
78
- finally:
79
- zeroconf.close()
80
- ` ``
59
+ .. code-block :: python
60
+
61
+ from zeroconf import raw_input , ServiceBrowser, Zeroconf
62
+
63
+
64
+ class MyListener ( object ):
65
+
66
+ def removeService ( self , zeroconf , type , name ):
67
+ print ( " Service %s removed " % (name,))
68
+
69
+ def addService ( self , zeroconf , type , name ):
70
+ info = zeroconf.getServiceInfo( type , name )
71
+ print ( " Service %s added, service info: %s " % (name, info))
72
+
73
+
74
+ zeroconf = Zeroconf ()
75
+ listener = MyListener( )
76
+ browser = ServiceBrowser(zeroconf, " _http._tcp.local. " , listener)
77
+ try :
78
+ raw_input ( " Press enter to exit... \n\n " )
79
+ finally :
80
+ zeroconf.close()
81
81
82
82
See examples directory for more.
83
83
0 commit comments