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.2.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.2-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_swos_lite-0.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 4e44985fb34d2df782f43cfe5b98cda9cc2fc445a327dd9dc8e99c77e7b28098
MD5 7ba9ec0ac2d522f0f04937827f53a349
BLAKE2b-256 f3203c32a82abbe3d8b355e9c3fdd6783e49667a508f6f3cb5a14a0fe0c7102c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_swos_lite-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 38f860cbb185f5e130ef734975912666e12d079f270b7d7ad5bda2d9bbf0a038
MD5 16ea32ef49460b55799f9a07f1cc2bab
BLAKE2b-256 9d9ec8d02a0c345bdc315b4217f9a12b5593b745e98663b9193e4aa698b4913f

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