Pure Python Multicast DNS Service Discovery Library (Bonjour/Avahi compatible)
This is fork of pyzeroconf, Multicast DNS Service Discovery for Python, originally by Paul Scott-Murphy (https://github.com/paulsm/pyzeroconf), modified by William McBrine (https://github.com/wmcbrine/pyzeroconf).
This fork is used in all of my TiVo-related projects: HME for Python (and therefore HME/VLC), Network Remote, Remote Proxy, and pyTivo. Before this, I was tracking the changes for zeroconf.py in three separate repos. I figured I should have an authoritative source.
Although I make changes based on my experience with TiVos, I expect that they’re generally applicable. This version also includes patches found on the now-defunct (?) Launchpad repo of pyzeroconf, and elsewhere around the net – not always well-documented, sorry.
Compared to some other Zeroconf/Bonjour/Avahi Python packages, python-zeroconf:
- has zero external dependencies
- isn’t tied to Bonjour or Avahi
- doesn’t use D-Bus
- doesn’t force you to use particular event loop or Twisted
- is pip-installable
- has PyPI distribution
- CPython 2.6, 2.7, 3.3+
- PyPy 2.2+ (possibly 1.9-2.1 as well)
How to get python-zeroconf?
- PyPI page https://pypi.python.org/pypi/zeroconf
- GitHub project https://github.com/jstasiak/python-zeroconf
The easiest way to install python-zeroconf is using pip:
pip install zeroconf
How do I use it?
Here’s an example:
from zeroconf import raw_input, ServiceBrowser, Zeroconf class MyListener(object): def removeService(self, zeroconf, type, name): print("Service %s removed" % (name,)) def addService(self, zeroconf, type, name): info = zeroconf.getServiceInfo(type, name) print("Service %s added, service info: %s" % (name, info)) zeroconf = Zeroconf() listener = MyListener() browser = ServiceBrowser(zeroconf, "_http._tcp.local.", listener) try: raw_input("Press enter to exit...\n\n") finally: zeroconf.close()
See examples directory for more.
- Fixed handling closed socket (GitHub #4)
- Forked by Jakub Stasiak
- Made Python 3 compatible
- Added setup script, made installable by pip and uploaded to PyPI
- Set up Travis build
- Reformatted the code and moved files around
- Stopped catching BaseException in several places, that could hide errors
- Marked threads as daemonic, they won’t keep application alive now
- Fix for SOL_IP undefined on some systems - thanks Mike Erdely.
- Cleaned up examples.
- Lowercased module name.
- Various minor changes; see git for details.
- No longer compatible with Python 2.2. Only tested with 2.5-2.7.
- Fork by William McBrine.
- allow selection of binding interface
- typo fix - Thanks A. M. Kuchlingi
- removed all use of word ‘Rendezvous’ - this is an API change
- correction to comments for addListener method
- support for new record types seen from OS X - IPv6 address - hostinfo
- ignore unknown DNS record types
- fixes to name decoding
- works alongside other processes using port 5353 (e.g. on Mac OS X)
- tested against Mac OS X 10.3.2’s mDNSResponder
- corrections to removal of list entries for service browser
- Jonathon Paisley contributed these corrections: - always multicast replies, even when query is unicast - correct a pointer encoding problem - can now write records in any order - traceback shown on failure - better TXT record parsing - server is now separate from name - can cancel a service browser
- modified some unit tests to accommodate these changes
- remove all records on service unregistration
- fix DOS security problem with readName
- changed licensing to LGPL
- faster shutdown on engine
- pointer encoding of outgoing names
- ServiceBrowser now works
- new unit tests
- small improvements with unit tests
- added defined exception types
- new style objects
- fixed hostname/interface problem
- fixed socket timeout problem
- fixed addServiceListener() typo bug
- using select() for socket reads
- tested on Debian unstable with Python 2.2.2
- ensure case insensitivty on domain names
- support for unicast DNS queries
- added some unit tests
- added __ne__ adjuncts where required
- ensure names end in ‘.local.’
- timeout on receiving socket for clean shutdown
LGPL, see COPYING file for details.
Release history Release notifications
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size & hash SHA256 hash help||File type||Python version||Upload date|
|zeroconf-0.15.1-py2.py3-none-any.whl (19.3 kB) Copy SHA256 hash SHA256||Wheel||3.4||Jul 10, 2014|
|zeroconf-0.15.1-py3-none-any.whl (19.3 kB) Copy SHA256 hash SHA256||Wheel||3.4||Jul 10, 2014|
|zeroconf-0.15.1.tar.gz (16.2 kB) Copy SHA256 hash SHA256||Source||None||Jul 10, 2014|