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

  • demjson3 3.0.6 or higher - for tolerant JSON parsing

Usage Example

Example with httpx

async def main(host, user, password):
    auth = DigestAuth(user, password)
    async with AsyncClient(auth=auth) as session:
        client = Client(createHttpClient(session), host)
        print(await client.fetch(SystemEndpoint))

Example with aiohttp

async def main(host, user, password):
    digest_auth = DigestAuthMiddleware(login=user, password=password)
    async with ClientSession(middlewares=(digest_auth, )) as session:
        client = Client(createHttpClient(session), host)
        return 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.5.tar.gz (7.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.5-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_swos_lite-0.0.5.tar.gz
  • Upload date:
  • Size: 7.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.5.tar.gz
Algorithm Hash digest
SHA256 85c9acb3762a09ea7149a5d84ccfa13b76a71c05aaa20da6b30a90c3c4faf4c2
MD5 874f072ed40a8f0a8ee867d845eb483c
BLAKE2b-256 5a19283982fb49348991c1bb5934f176dd6f828b6d4350db4f07395c36244dbc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_swos_lite-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 085eaaf1ad167456cb8168273f5f455dbc776f66791fbdaf371dbc0c37d595d1
MD5 fab9fc3d00a22c2f4fe957b21342810f
BLAKE2b-256 327334822ea761594f6bd08aa49d6f2ec2947d275831f5fab886326948373325

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