| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This project is a fork of pyzeroconf, originally by Paul Scott-Murphy (https://github.com/paulsm/pyzeroconf), modified by William McBrine (https://github.com/wmcbrine/pyzeroconf).
Compatible with:
Compared to some other Zeroconf/Bonjour/Avahi Python packages, python-zeroconf:
This project uses semantic versioning.
This project is actively maintained.
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 is relatively new and currently limited, specifically:
The easiest way to install python-zeroconf is using pip:
pip install zeroconf
Here's how to discover services:
from zeroconf import ServiceBrowser, ServiceListener, Zeroconf
class EventLogger(ServiceListener):
def add_service(self, zc: Zeroconf, type_: str, name: str) -> None:
info = zc.get_service_info(type_, name)
print(f"discovered {name}: {info}")
def remove_service(self, zc: Zeroconf, type_: str, name: str) -> None:
print(f"lost {name}")
def update_service(self, zc: Zeroconf, type_: str, name: str) -> None:
print(f"refreshed {name}")
with Zeroconf() as zc:
ServiceBrowser(zc, "_http._tcp.local.", EventLogger())
input("browsing, press enter to stop\n")Note
Discovery and service registration use all available network interfaces by default. If you want to customize that you need to specify interfaces argument when constructing Zeroconf object (see the code for details).
To see which service types are present on the network, try:
from zeroconf import ZeroconfServiceTypes
print('\n'.join(ZeroconfServiceTypes.find()))See examples directory for more.
GNU Lesser General Public License v2.1 or later (LGPL-2.1-or-later).
The full text of LGPL 2.1 is included in the COPYING file. You may, at your option, use this library under the terms of any later version of the LGPL published by the Free Software Foundation. The canonical SPDX identifier for this project is LGPL-2.1-or-later, as declared in pyproject.toml.
| Back | FazBrowse Home | New Git URL |