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(create_httpx_client(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(create_aiohttp_client(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.20 and 2.21

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.9.tar.gz (14.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_switchos-0.0.9-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for python_switchos-0.0.9.tar.gz
Algorithm Hash digest
SHA256 b69267d8f4aa825a1bbd645df732abbd9c1c606921527a754096e7ae0242f5b7
MD5 b990ec5851b1d56c72976b9a3122aac8
BLAKE2b-256 1b3b3cf8907fac614fd94d0302b707514a711e07584522e178d7d72a0ffdae32

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_switchos-0.0.9.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.9-py3-none-any.whl.

File metadata

File hashes

Hashes for python_switchos-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 027090bcf994c1bb32d4bbbc8d152826f943370876f8db36aa2f30d194289ec0
MD5 06e321a289a167ac7cc452b63b9265ad
BLAKE2b-256 224f120c2cbcc0bec1c3927a05cb7cce12f4321d602347a180cfb2ec98344fe8

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_switchos-0.0.9-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