Skip to main content

A pure python implementation of multicast DNS service discovery

Project description

python-zeroconf

https://github.com/python-zeroconf/python-zeroconf/workflows/CI/badge.svg https://img.shields.io/pypi/v/zeroconf.svg https://codecov.io/gh/python-zeroconf/python-zeroconf/branch/master/graph/badge.svg

Documentation.

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.8+

  • PyPy3.8 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?

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

Changelog

License

LGPL, see COPYING file for 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

zeroconf-0.132.2.tar.gz (170.7 kB view hashes)

Uploaded Source

Built Distributions

zeroconf-0.132.2-pp310-pypy310_pp73-win_amd64.whl (4.6 MB view hashes)

Uploaded PyPy Windows x86-64

zeroconf-0.132.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.9 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

zeroconf-0.132.2-pp310-pypy310_pp73-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl (4.9 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

zeroconf-0.132.2-pp310-pypy310_pp73-macosx_11_0_x86_64.whl (4.6 MB view hashes)

Uploaded PyPy macOS 11.0+ x86-64

zeroconf-0.132.2-pp39-pypy39_pp73-win_amd64.whl (4.6 MB view hashes)

Uploaded PyPy Windows x86-64

zeroconf-0.132.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.9 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

zeroconf-0.132.2-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl (4.9 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

zeroconf-0.132.2-pp39-pypy39_pp73-macosx_11_0_x86_64.whl (4.6 MB view hashes)

Uploaded PyPy macOS 11.0+ x86-64

zeroconf-0.132.2-pp38-pypy38_pp73-win_amd64.whl (4.6 MB view hashes)

Uploaded PyPy Windows x86-64

zeroconf-0.132.2-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.9 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

zeroconf-0.132.2-pp38-pypy38_pp73-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl (4.9 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

zeroconf-0.132.2-pp38-pypy38_pp73-macosx_11_0_x86_64.whl (4.6 MB view hashes)

Uploaded PyPy macOS 11.0+ x86-64

zeroconf-0.132.2-cp312-cp312-win_amd64.whl (4.7 MB view hashes)

Uploaded CPython 3.12 Windows x86-64

zeroconf-0.132.2-cp312-cp312-win32.whl (4.5 MB view hashes)

Uploaded CPython 3.12 Windows x86

zeroconf-0.132.2-cp312-cp312-musllinux_1_1_x86_64.whl (14.2 MB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ x86-64

zeroconf-0.132.2-cp312-cp312-musllinux_1_1_i686.whl (13.5 MB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ i686

zeroconf-0.132.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (14.2 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

zeroconf-0.132.2-cp312-cp312-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl (13.6 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

zeroconf-0.132.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (14.1 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

zeroconf-0.132.2-cp312-cp312-macosx_11_0_x86_64.whl (5.0 MB view hashes)

Uploaded CPython 3.12 macOS 11.0+ x86-64

zeroconf-0.132.2-cp311-cp311-win_amd64.whl (4.7 MB view hashes)

Uploaded CPython 3.11 Windows x86-64

zeroconf-0.132.2-cp311-cp311-win32.whl (4.5 MB view hashes)

Uploaded CPython 3.11 Windows x86

zeroconf-0.132.2-cp311-cp311-musllinux_1_1_x86_64.whl (14.4 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

zeroconf-0.132.2-cp311-cp311-musllinux_1_1_i686.whl (13.8 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ i686

zeroconf-0.132.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (14.4 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

zeroconf-0.132.2-cp311-cp311-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl (13.8 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

zeroconf-0.132.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (11.3 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

zeroconf-0.132.2-cp311-cp311-macosx_11_0_x86_64.whl (5.0 MB view hashes)

Uploaded CPython 3.11 macOS 11.0+ x86-64

zeroconf-0.132.2-cp310-cp310-win_amd64.whl (4.7 MB view hashes)

Uploaded CPython 3.10 Windows x86-64

zeroconf-0.132.2-cp310-cp310-win32.whl (4.5 MB view hashes)

Uploaded CPython 3.10 Windows x86

zeroconf-0.132.2-cp310-cp310-musllinux_1_1_x86_64.whl (13.5 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

zeroconf-0.132.2-cp310-cp310-musllinux_1_1_i686.whl (12.9 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ i686

zeroconf-0.132.2-cp310-cp310-manylinux_2_31_x86_64.whl (10.4 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.31+ x86-64

zeroconf-0.132.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.4 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

zeroconf-0.132.2-cp310-cp310-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl (12.9 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

zeroconf-0.132.2-cp310-cp310-macosx_11_0_x86_64.whl (5.0 MB view hashes)

Uploaded CPython 3.10 macOS 11.0+ x86-64

zeroconf-0.132.2-cp39-cp39-win_amd64.whl (4.7 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

zeroconf-0.132.2-cp39-cp39-win32.whl (4.5 MB view hashes)

Uploaded CPython 3.9 Windows x86

zeroconf-0.132.2-cp39-cp39-musllinux_1_1_x86_64.whl (13.5 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

zeroconf-0.132.2-cp39-cp39-musllinux_1_1_i686.whl (13.0 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ i686

zeroconf-0.132.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.5 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

zeroconf-0.132.2-cp39-cp39-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl (13.0 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

zeroconf-0.132.2-cp39-cp39-macosx_11_0_x86_64.whl (5.0 MB view hashes)

Uploaded CPython 3.9 macOS 11.0+ x86-64

zeroconf-0.132.2-cp38-cp38-win_amd64.whl (4.7 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

zeroconf-0.132.2-cp38-cp38-win32.whl (1.4 MB view hashes)

Uploaded CPython 3.8 Windows x86

zeroconf-0.132.2-cp38-cp38-musllinux_1_1_x86_64.whl (11.1 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

zeroconf-0.132.2-cp38-cp38-musllinux_1_1_i686.whl (10.5 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ i686

zeroconf-0.132.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (10.7 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

zeroconf-0.132.2-cp38-cp38-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl (10.1 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

zeroconf-0.132.2-cp38-cp38-macosx_11_0_x86_64.whl (2.0 MB view hashes)

Uploaded CPython 3.8 macOS 11.0+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page