Skip to main content

Python client for the Swisscom Internet-Box

Project description

python-swisscom-internet-box

Async Python client for the Swisscom Internet-Box local API (/ws endpoint).

Installation

pip install python-swisscom-internet-box

Usage

import asyncio
import aiohttp
from swisscom_internet_box import SwisscomClient

async def main():
    async with aiohttp.ClientSession() as session:
        client = SwisscomClient(session, "192.168.1.1", "admin", "your-password")

        # Device info & WAN status (unauthenticated)
        info = await client.get_box_info()
        print(f"{info.model_name} — FW {info.software_version}")

        wan = await client.get_wan_status()
        print(f"WAN: {wan.connection_state} ({wan.protocol})")

        # WiFi access points (includes guest network)
        for ap in await client.get_access_points():
            label = "guest" if ap.is_guest else "main"
            print(f"[{label}] {ap.ssid}{ap.frequency_band}{'on' if ap.enabled else 'off'}")

        # Connected LAN devices
        for device in await client.get_devices():
            if device.active:
                print(f"{device.name}{device.ip_address}{'wifi' if device.is_wireless else 'eth'}")

asyncio.run(main())

API

SwisscomClient(session, host, username, password)

Method Auth required Description
get_box_info() No Manufacturer, model, firmware, MAC, uptime
get_wan_status() No Link type/state, protocol, connection state
get_nmc_info() No WAN mode, active interface, provisioning state
get_wifi_status() No WiFi global enable/active state
get_access_points() Yes All VAPs (main + guest); use ap.is_guest to filter
get_devices(expression) Yes LAN devices; default expression: "lan and not self"

Device expressions

Expression Result
"lan and not self" All LAN clients (default)
"wifi" Wireless clients only
"eth" Wired clients only

Models

  • BoxInfomanufacturer, model_name, software_version, base_mac, up_time, device_status
  • WANStatuslink_type, link_state, protocol, connection_state, .is_connected
  • NMCInfowan_mode, active_wan_interface, provisioning_state
  • WiFiStatusenabled, active, wps_enabled, scheduler_enabled
  • AccessPointkey, ssid, bssid, enabled, frequency_band, channel, .is_guest
  • Devicekey, name, phys_address, ip_address, active, interface_name, .is_wireless, ipv4_addresses, ipv6_addresses, bandwidth

Compatibility

Tested on Internet-Box 4 (IB4-00, firmware 14.20.40). Should work on IB2, IB3 and IB5 running similar firmware.

License

MIT

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

python_swisscom_internet_box-0.1.1.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_swisscom_internet_box-0.1.1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file python_swisscom_internet_box-0.1.1.tar.gz.

File metadata

File hashes

Hashes for python_swisscom_internet_box-0.1.1.tar.gz
Algorithm Hash digest
SHA256 109859d23635b0b271d5c40df6af9df1d71926d2f6f4e41ca607342c9e9636ef
MD5 2b468edb8a2d3708b3608f3875943e52
BLAKE2b-256 b4208698c3cc28471a368cb17d961f1dbadd7a8b87858bb18d5000c1235f1330

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_swisscom_internet_box-0.1.1.tar.gz:

Publisher: publish.yml on anatosun/python-swisscom-internet-box

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file python_swisscom_internet_box-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for python_swisscom_internet_box-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 faf3fdddac6b9b8ec9746022abc7f2ab1e1b2d1ab150305bc817df1445eaea14
MD5 6fd87e92bf21b0c840e26ca9399b4709
BLAKE2b-256 e7b134d21624fa277d9931cb1b5df7c61d00f7dd67680135fe294893a55a70bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_swisscom_internet_box-0.1.1-py3-none-any.whl:

Publisher: publish.yml on anatosun/python-swisscom-internet-box

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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