Skip to main content

Python library to interact with MikroTik SwitchOS Lite

Project description

python-swos-lite

Python library to interact with MikroTik SwitchOS Lite

Features

  • Get identity, model, serial number, OS version, MAC and IP address

  • Read cpu temperature, current, voltage, and power consumption of the switch

  • List ports with name, status, speed, duplex mode etc.

  • Check PoE status, power usage, voltage, and current per port

Installation

Install via pip:

pip install python-swos-lite

Requires Python 3.10 or higher

Dependencies

  • aiohttp 3.12.8 or higher – for HTTP communication with the switch
  • demjson3 3.0.6 or higher - for tolerant JSON parsing

Usage Example

from aiohttp import ClientSession, DigestAuthMiddleware
from swos_lite.client import Client
from swos_lite.endpoints.link import LinkEndpoint
from swos_lite.endpoints.sys import SystemEndpoint
from swos_lite.endpoints.poe import PoEEndpoint

async def main():
    digest_auth = DigestAuthMiddleware(login="user", password="password")
    async with ClientSession(middlewares=(digest_auth,)) as session:
        session._middlewares = (digest_auth,)
        client = Client(session, "http://swos-lite.local")
        await client.fetch(SystemEndpoint)

Supported Devices

This library targets MikroTik switches running SwitchOS Lite and has been tested with:

  • MikroTik CSS610-8P-2S+ running Switch OS Lite 2.19

Other models with SwitchOS Lite may also work.

License

MIT License

Contributing

Contributions are welcome!
Feel free to open issues, submit pull requests, or suggest features.

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_swos_lite-0.0.3.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

python_swos_lite-0.0.3-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file python_swos_lite-0.0.3.tar.gz.

File metadata

  • Download URL: python_swos_lite-0.0.3.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.4

File hashes

Hashes for python_swos_lite-0.0.3.tar.gz
Algorithm Hash digest
SHA256 a137cee5ec731e16cff972615fec13751d629c99213a44c7bada16ea7e4c7c46
MD5 cf90aee7c818b0e0c77b451ba90815ef
BLAKE2b-256 7a2e5f043a7dd98b11fd1c71f824d466996db99450670c199a04412d1d7dce3e

See more details on using hashes here.

File details

Details for the file python_swos_lite-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for python_swos_lite-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 308729fac88f897e1d0f1165b88947f3602160f89fc1e3e2e095428062ace195
MD5 253cca7615e7a105f3b5f1973dd96e99
BLAKE2b-256 edad97352e59869e3dfe4771a829f42e00fc26ef50b758268a4d00dcd341e31f

See more details on using hashes here.

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