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.8.tar.gz (13.9 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.8-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_switchos-0.0.8.tar.gz
  • Upload date:
  • Size: 13.9 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.8.tar.gz
Algorithm Hash digest
SHA256 4dc622f1c4441ce320c1e08d9c3a2fc6210eedc103e8e9413b7497b67980ec19
MD5 ba7a9783a266cdecb1362da17530bac6
BLAKE2b-256 294ffba204198addedf08bcfd82b607bd14e65de6c0e35f536faf8e0c0ba8071

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for python_switchos-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 d15acb2e25134fb279f4105735bb8879359a0564ed7c28ae69ec7396769797dd
MD5 93e46340ef7ca95fec7bcd36fa04d887
BLAKE2b-256 c12961c67f2942411b3d02f80b7aacdb4f240b46de6f1e9182f209f7ce95a97f

See more details on using hashes here.

Provenance

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