A pure python implementation of multicast DNS service discovery
Project description
python-zeroconf
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).
The original William McBrine’s fork note:
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.
Compatible with:
Bonjour
Avahi
Compared to some other Zeroconf/Bonjour/Avahi Python packages, python-zeroconf:
isn’t tied to Bonjour or Avahi
doesn’t use D-Bus
doesn’t force you to use particular event loop or Twisted (asyncio is used under the hood but not required)
is pip-installable
has PyPI distribution
has an optional cython extension for performance (pure python is supported as well)
Python compatibility
CPython 3.7+
PyPy3.7 7.3+
Versioning
This project uses semantic versioning.
Status
This project is actively maintained.
Traffic Reduction
Before version 0.32, most traffic reduction techniques described in https://datatracker.ietf.org/doc/html/rfc6762#section-7 where not implemented which could lead to excessive network traffic. It is highly recommended that version 0.32 or later is used if this is a concern.
IPv6 support
IPv6 support is relatively new and currently limited, specifically:
InterfaceChoice.All is an alias for InterfaceChoice.Default on non-POSIX systems.
Dual-stack IPv6 sockets are used, which may not be supported everywhere (some BSD variants do not have them).
Listening on localhost (::1) does not work. Help with understanding why is appreciated.
How to get python-zeroconf?
PyPI page https://pypi.org/project/zeroconf/
GitHub project https://github.com/python-zeroconf/python-zeroconf
The easiest way to install python-zeroconf is using pip:
pip install zeroconf
How do I use it?
Here’s an example of browsing for a service:
from zeroconf import ServiceBrowser, ServiceListener, Zeroconf
class MyListener(ServiceListener):
def update_service(self, zc: Zeroconf, type_: str, name: str) -> None:
print(f"Service {name} updated")
def remove_service(self, zc: Zeroconf, type_: str, name: str) -> None:
print(f"Service {name} removed")
def add_service(self, zc: Zeroconf, type_: str, name: str) -> None:
info = zc.get_service_info(type_, name)
print(f"Service {name} added, service info: {info}")
zeroconf = Zeroconf()
listener = MyListener()
browser = ServiceBrowser(zeroconf, "_http._tcp.local.", listener)
try:
input("Press enter to exit...\n\n")
finally:
zeroconf.close()
If you don’t know the name of the service you need to browse for, try:
from zeroconf import ZeroconfServiceTypes
print('\n'.join(ZeroconfServiceTypes.find()))
See examples directory for more.
Changelog
License
LGPL, see COPYING file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for zeroconf-0.58.1-pp39-pypy39_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fe2788ed25c79f4010b3da8015b8823df5e2824fce84762115259f9a2da5f25 |
|
MD5 | 2605d2c7b6aa5d77eb95fe4a408a45af |
|
BLAKE2b-256 | 8b039dce5a590f36013b3c6f58a825802ba0a3217c39ce07f8ad588380d24109 |
Hashes for zeroconf-0.58.1-pp38-pypy38_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aae7a2c0d561f97e22f62a5a5b6c46d7939fe67528b333ba57cd42dd5bc42191 |
|
MD5 | 46f389cd3a655ccf2ea84d4f4280f287 |
|
BLAKE2b-256 | 65fbad5b53db0b2e13f37ce5b9ed86f290c531906b44843146efdef044bde750 |
Hashes for zeroconf-0.58.1-pp37-pypy37_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0fff75ca2beffe66f0421b74ef50798fd8aaeddcea60592658559718104e0d59 |
|
MD5 | c769de7acc6ffc64904c60617fb6bd05 |
|
BLAKE2b-256 | 361db00de5906bdaef4b38543666ad45cd9c3477528645aad76dab5ce88153bb |
Hashes for zeroconf-0.58.1-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd342468840fc465f2f154d13d0d44b8adb5cc6c31b722a71cb3b89bdf0f73e3 |
|
MD5 | 40c370e2a6b8c3c631f7f2bc86153db9 |
|
BLAKE2b-256 | 72bd17f99bdc7724464963ef5f093eb7b6e7a173d39c833a56ad0e5e4e16e279 |
Hashes for zeroconf-0.58.1-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66678a6e65916a8a71e66d030093e9bed57f57c488de7d8dd0aff5b5ca352eae |
|
MD5 | ebce8556aa0354532079934dc1c03829 |
|
BLAKE2b-256 | 89ac17eb7ea24bedef1d78fd58d8bbf559961f914219cbd1a7e16cade43b3875 |
Hashes for zeroconf-0.58.1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8a85503b90472896d4acd8512c3ea2a33131a954758b9b2f0186832837e0e38 |
|
MD5 | b6b386c64a70b6e59abc7a350e194133 |
|
BLAKE2b-256 | db106bbf5bf42c0c4b5c9e4164f6bd30a8c8dbe03b918123e188c3e1177bdd88 |
Hashes for zeroconf-0.58.1-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b3eb283953caac0036e9b4c8cd775e450c8eb425d13930faf6c6a6eed33391e |
|
MD5 | 9b37ce49d15c69a5454452fabe849909 |
|
BLAKE2b-256 | 20a4189a473f300fcace52cbff8695ae030e70c9a920e886f534e58bcf6a2171 |
Hashes for zeroconf-0.58.1-cp310-cp310-manylinux_2_31_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c72d7b9ddbfc2a0eaf94d792342279d6c9c6e89cdcfbf2f8ddbdb29710ddf775 |
|
MD5 | 8a24c9357fe6ba013a56f061f6eeb525 |
|
BLAKE2b-256 | 3cf8935f1e97655555f83bcbe8ade4e6d282ab9756393e5b4a09e00575241857 |
Hashes for zeroconf-0.58.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbca4b0754ba3d7efa34916ae32b5eb92764a34a812f351bfa1fa7776342d4b1 |
|
MD5 | 15bcd7a5544093bb1b4ce75dc14027f7 |
|
BLAKE2b-256 | e2629b2041042afa84c7a1ece0127d5caefa271c2eab1a60273e396f96a0de22 |
Hashes for zeroconf-0.58.1-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4ee1a21550f168caa89c4e7ffc6b513a1d82cdc0145fbb28db8277547e24486 |
|
MD5 | af2c3599e13af1d43a9eaa46022338bc |
|
BLAKE2b-256 | 77003370fb593a1ced765d7db292218e22d5a0e5347ca601fd37fc66326679e5 |
Hashes for zeroconf-0.58.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e8fffb0e4b25a906fb9e0b5ee792f4087af40a4689a3379d4a060feac8696d8 |
|
MD5 | f1c302f6a631f0bc003e08ee47e80b7c |
|
BLAKE2b-256 | b2402abf836b8fc786df29fa62bc82ddf5537778dbaf7d32f8863d07c3335203 |
Hashes for zeroconf-0.58.1-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc4d288ebcfbd0021269c5bd5eb8e8125022a194f6dcee773c13ccba34c65a7a |
|
MD5 | 5d364491bf28efd125e7448edb96a7ff |
|
BLAKE2b-256 | b8078cfb31f989dfa9628d4532b031eb63af4dced98fd82725bd22d097464b88 |
Hashes for zeroconf-0.58.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e55beeef07e4f1dd8a8ebe711ad7c64d3f7f84436cd4882994340aea60a3d038 |
|
MD5 | fd204c576804ef51acb2a1a4381797ce |
|
BLAKE2b-256 | 8e6ddc939dca5f3dffed4900487401e730314ef2a8dcede0f53a660c9dd7e64b |
Hashes for zeroconf-0.58.1-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cda35f497c8b889f336462e0e69fb46790e7114e30b90cb5b123d69558194d82 |
|
MD5 | 9d592217cb560b9539197749419047cc |
|
BLAKE2b-256 | 08bef51147368e8eaa204e7c7821df3a0a799411f7be06818be49e35e00b1f72 |