Skip to content

Commit c056ac3

Browse files
authored
Support new zeroconf version. (#73)
Fixes #72
1 parent 44bf705 commit c056ac3

4 files changed

Lines changed: 24 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [Unreleased]
44

5+
## [0.13.1] - 2020-05-29
6+
### Changed
7+
- Support new zeroconf version
8+
59
## [0.13.0] - 2020-05-04
610
### Changed
711
- Invalid POST requests to action resources now generate an error status.
@@ -45,7 +49,8 @@
4549
### Changed
4650
- Property, Action, and Event description now use `links` rather than `href`. - [Spec PR](https://github.com/mozilla-iot/wot/pull/119)
4751

48-
[Unreleased]: https://github.com/mozilla-iot/webthing-python/compare/v0.13.0...HEAD
52+
[Unreleased]: https://github.com/mozilla-iot/webthing-python/compare/v0.13.1...HEAD
53+
[0.13.0]: https://github.com/mozilla-iot/webthing-python/compare/v0.13.0...v0.13.1
4954
[0.13.0]: https://github.com/mozilla-iot/webthing-python/compare/v0.12.2...v0.13.0
5055
[0.12.2]: https://github.com/mozilla-iot/webthing-python/compare/v0.12.1...v0.12.2
5156
[0.12.1]: https://github.com/mozilla-iot/webthing-python/compare/v0.12.0...v0.12.1

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ pyee>=7.0.0
55
tornado==5.1.*; python_version == '2.7'
66
tornado>=6.0.0; python_version >= '3.5'
77
zeroconf==0.19.*; python_version == '2.7'
8-
zeroconf>=0.26.0; python_version >= '3.5'
8+
zeroconf>=0.27.0; python_version >= '3.5'

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
requirements.extend([
2828
'jsonschema>=3.2.0',
2929
'tornado>=6.0.0',
30-
'zeroconf>=0.26.0',
30+
'zeroconf>=0.27.0',
3131
])
3232

3333
setup(
3434
name='webthing',
35-
version='0.13.0',
35+
version='0.13.1',
3636
description='HTTP Web Thing implementation',
3737
long_description=long_description,
3838
url='https://github.com/mozilla-iot/webthing-python',

webthing/server.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from zeroconf import ServiceInfo, Zeroconf
44
import json
55
import socket
6+
import sys
67
import tornado.concurrent
78
import tornado.gen
89
import tornado.httpserver
@@ -853,15 +854,24 @@ def __init__(self, things, port=80, hostname=None, ssl_options=None,
853854

854855
def start(self):
855856
"""Start listening for incoming connections."""
856-
self.service_info = ServiceInfo(
857+
args = [
857858
'_webthing._tcp.local.',
858859
'{}._webthing._tcp.local.'.format(self.name),
859-
address=socket.inet_aton(get_ip()),
860-
port=self.port,
861-
properties={
860+
]
861+
kwargs = {
862+
'port': self.port,
863+
'properties': {
862864
'path': '/',
863865
},
864-
server='{}.local.'.format(socket.gethostname()))
866+
'server': '{}.local.'.format(socket.gethostname()),
867+
}
868+
869+
if sys.version_info.major == 3:
870+
kwargs['addresses'] = [socket.inet_aton(get_ip())]
871+
else:
872+
kwargs['address'] = socket.inet_aton(get_ip())
873+
874+
self.service_info = ServiceInfo(*args, **kwargs)
865875
self.zeroconf = Zeroconf()
866876
self.zeroconf.register_service(self.service_info)
867877

0 commit comments

Comments
 (0)