summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJakub Stasiak <jakub@stasiak.at>2014-11-02 20:31:54 +0000
committerJakub Stasiak <jakub@stasiak.at>2014-11-02 20:48:05 +0000
commit5429748190950a5daf7e9cf91de824dfbd06ee7a (patch)
treeb089859224344bed6b7aef24f5703600c14acae1 /examples
parentada563c5a1f6d7c54f2ae5c495503079c395438f (diff)
Switch to snake case and clean up import order
Closes #2
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/browser.py21
-rwxr-xr-xexamples/registration.py4
2 files changed, 12 insertions, 13 deletions
diff --git a/examples/browser.py b/examples/browser.py
index 219c9ed..1b3b717 100755
--- a/examples/browser.py
+++ b/examples/browser.py
@@ -10,24 +10,23 @@ from zeroconf import raw_input, ServiceBrowser, Zeroconf
class MyListener(object):
- def removeService(self, zeroconf, type, name):
+ def remove_service(self, zeroconf, type, name):
print("Service %s removed" % (name,))
print('\n')
- def addService(self, zeroconf, type, name):
+ def add_service(self, zeroconf, type, name):
print("Service %s added" % (name,))
print(" Type is %s" % (type,))
- info = zeroconf.getServiceInfo(type, name)
+ info = zeroconf.get_service_info(type, name)
if info:
- print(" Address is %s:%d" % (socket.inet_ntoa(info.getAddress()),
- info.getPort()))
- print(" Weight is %d, Priority is %d" % (info.getWeight(),
- info.getPriority()))
- print(" Server is", info.getServer())
- prop = info.getProperties()
- if prop:
+ print(" Address is %s:%d" % (socket.inet_ntoa(info.address),
+ info.port))
+ print(" Weight is %d, Priority is %d" % (info.weight,
+ info.priority))
+ print(" Server is", info.server)
+ if info.properties:
print(" Properties are")
- for key, value in prop.items():
+ for key, value in info.properties.items():
print(" %s: %s" % (key, value))
else:
print(" No info")
diff --git a/examples/registration.py b/examples/registration.py
index 293047f..18e440f 100755
--- a/examples/registration.py
+++ b/examples/registration.py
@@ -15,10 +15,10 @@ info = ServiceInfo("_http._tcp.local.",
zeroconf = Zeroconf()
print("Registration of a service...")
-zeroconf.registerService(info)
+zeroconf.register_service(info)
try:
raw_input("Waiting (press Enter to exit)...")
finally:
print("Unregistering...")
- zeroconf.unregisterService(info)
+ zeroconf.unregister_service(info)
zeroconf.close()