Skip to main content

avahi-json

@readwithai - X - blog - machine-aided reading - 📖⚡️🖋️

Query the local network for devices and services using MDNS bia avahi (like avahi-browser -ar) but output results in easy-to-use JSON.

Motivation

I have an Android phone on my home network. I also use KDE connect on the phone. I occassionally want to connect to this phone via ADB over a TCP connection, but the IP address is not fixed.

I could use KDE connect to find the device since KDE connect advertises itself using an MDNS services (i.e. avahi). This would be all well and good - but the avahi command-line tool neither allows me to directly query for my phone, nor does it produce machine-readable output.

Therefore I am writing something which queries for services on the network using avahi and outputs theresult in beautiful JSON. I am slightly surprised that no one has done this before.

Installation

You must first install the python3-avahi bindings. These are handled by apt on Ubuntu and can be installed with sudo apt install python3-avahi.

You can then install avahi-json itself using pipx with the following command (--system-site-packages is needed for avahi and dbus):

pipx install --system-site-packages avahi-json

You need to have avahi, Linux's mdns daemon, installed to use this. But this tends to be installed by default.

Usage

Run avahi-json: this will give you services on the network with a separate JSON entry on each line.

About me

I am @readwithai. I create tools for reading, research and agency sometimes using the markdown editor Obsidian.

I also create a stream of tools that are related to carrying out my work.

I write about lots of things - including tools like this - on X. My blog is more about reading and research and agency.

Metadata

Release files for avahi-json 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for avahi-json 1.1.0
File Size Uploaded Provenance Actions
avahi_json-1.1.0.tar.gz 3.9 kB Without provenance Details for avahi_json-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for avahi-json 1.1.0
File Interpreter ABI Platform Actions
avahi_json-1.1.0-py3-none-any.whl Python 3 none any Details for avahi_json-1.1.0-py3-none-any.whl

Total release size: 8.2 kB

Release files / avahi_json-1.1.0.tar.gz

Download URL avahi_json-1.1.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6b42b16e0363f2553b90d9581c656ac343f6951df61c2db025d35527ae994449
BLAKE2b-256 checksum
How to use checksums
784de4bdd7394b6095d5023b6092e8ce00de3345b29366704446ef538b666da6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / avahi_json-1.1.0-py3-none-any.whl

Download URL avahi_json-1.1.0-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9e7af3932dfeccc9b17c741d52406a5ff256e5e8b07a6167ed53ed00deeb6ea5
BLAKE2b-256 checksum
How to use checksums
220f3fd63bbb1500a77a416f5c89ee50e96ecb08e4c4f2a42907b5d0a8fb64a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for avahi-json 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page