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.4.tar.gz (7.3 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.4-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_swos_lite-0.0.4.tar.gz
  • Upload date:
  • Size: 7.3 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.4.tar.gz
Algorithm Hash digest
SHA256 f44c8ad408c98f0d9d04630f607177d5dab710b6c073f357977ff9648a1ed74a
MD5 d3f7796be8c0e97ec08e7517e649a651
BLAKE2b-256 b84fd1b17e4780cedca8897280aedd74c4f5b66a72bf0a1af4e5498959a4c376

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_swos_lite-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0e4feff749adc9971ab958498a1a359cedfee48a04b0f1117e144116967f5de8
MD5 4b1a5ede43ead6686bb8f6cad88e7439
BLAKE2b-256 99c18a4287227dfe9817d91ea240bedf06154c86e571d8464dd2e99cee304ce2

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