A pure python implementation of multicast DNS service discovery
Reason this release was yanked:
Ran out of space on pypi, release incomplete
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?
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
File details
Details for the file zeroconf-0.113.0.tar.gz
.
File metadata
- Download URL: zeroconf-0.113.0.tar.gz
- Upload date:
- Size: 155.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/42.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.0.5 tqdm/4.66.1 importlib-metadata/6.8.0 keyring/24.2.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e9b5e35e73291b6b6e0506b0e9d051e39b88edc3962b972d9aa72884fb48eec |
|
MD5 | f6583f64d12702b56e2863782a53c8c5 |
|
BLAKE2b-256 | b84e1731e8491b082bf00c1282b0304a5620500c82bf92da336fdf137ae28e96 |
File details
Details for the file zeroconf-0.113.0-cp310-cp310-manylinux_2_31_x86_64.whl
.
File metadata
- Download URL: zeroconf-0.113.0-cp310-cp310-manylinux_2_31_x86_64.whl
- Upload date:
- Size: 6.8 MB
- Tags: CPython 3.10, manylinux: glibc 2.31+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/42.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.0.5 tqdm/4.66.1 importlib-metadata/6.8.0 keyring/24.2.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d431c169f877dd9fcbcb2c226c9cfa1539ef9456d6072de98d14808b8bbc0d98 |
|
MD5 | e5210d690138ce05a68c395bbb0edea7 |
|
BLAKE2b-256 | e5179197ecbc903f34bf49a743bcfddf0ba3a0b78bafabdaf6a597ed13524a21 |
File details
Details for the file zeroconf-0.113.0-cp310-cp310-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: zeroconf-0.113.0-cp310-cp310-macosx_11_0_x86_64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.10, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0a1fb6e161d9ccacdf1c10ee63a8098a61e97185aae5b44aec98b825159c3eb |
|
MD5 | 38bbf361134b3a93120761c1f74579b3 |
|
BLAKE2b-256 | 3c2910156e856003d8c9508407a34ee7a97453a1cf6dc25e5155cd536c22dff7 |