Skip to main content

Connected network devices using DBus

Project description

DBus Network Devices

PyPI Python versions License

The dbus-networkdevices library empowers Python applications to get the active network devices that are connected to your network.

Key Features

  • IP Access: Retrieve interface name, ip addresses, wifi ssid, etc...
  • Real-time Updates: Utilizes callback functions to provide instant updates of network changes.

Requirements

  • Python 3.7 or later
  • dasdbus library

Installation

Install the library using pip:

pip install dbus-networkdevices

Usage

This library offers two primary usage approaches:

Command-Line Interaction

If you prefer a quick way to view information or control playback, you can potentially execute the dbus-networkdevices script directly. For more extensive programmatic control, I would recommend using the library within your Python code.

Programmatic Control

Import the DBUSNetworkDevices class from your Python code:

import json
from dbus_networkdevices import DBUSNetworkDevices

def callback(devices):
    # Handle the list of network devices here
    print(json.dumps(devices, indent=2))

# Create an instance of the class
DBUSNetworkDevices(callback)

# Keep the app running
while True:
    time.sleep(1)

Inspiration

Most python applications use iwgetid and information from /proc/net/wireless to get the WiFi status, so I created this library to get the information directly from DBus and also include other interfaces.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbus_networkdevices-2024.7.0.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

dbus_networkdevices-2024.7.0-py3-none-any.whl (4.8 kB view hashes)

Uploaded Python 3

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