Skip to main content

Python library to interact with MikroTik SwitchOS and SwitchOS Lite

Project description

python-switchos

Python library to interact with MikroTik SwitchOS and 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-switchos

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 or SwitchOS Lite and has been tested with:

  • Mikrotik CRS326-24G-2S+ running Switch OS 2.18
  • MikroTik CSS610-8P-2S+ running Switch OS Lite 2.19 and 2.20

Other models with SwitchOS or 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_switchos-0.0.7.tar.gz (8.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_switchos-0.0.7-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file python_switchos-0.0.7.tar.gz.

File metadata

  • Download URL: python_switchos-0.0.7.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for python_switchos-0.0.7.tar.gz
Algorithm Hash digest
SHA256 48bab3dada42553a694964d52f7818758371816f1ac16426e6a99adfd1caebc9
MD5 d4e33ef46817a571bfb95b6158a30576
BLAKE2b-256 98e3f8e6e3d3f98e38b61fffa798e44c19c86fe26f03435756d39413d563a58f

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_switchos-0.0.7.tar.gz:

Publisher: python-publish.yml on probert94/python-switchos

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_switchos-0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for python_switchos-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 8b6d8aa39e5b227a00d596365a6947e406868b417d4db756c1d56017eceabece
MD5 c4615830e8aeda32f6b53fb5f62ff1ac
BLAKE2b-256 9c87b095f77d0096b0b235c34382139c20b951775bda09e67ae2b008047feb1b

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_switchos-0.0.7-py3-none-any.whl:

Publisher: python-publish.yml on probert94/python-switchos

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