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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48bab3dada42553a694964d52f7818758371816f1ac16426e6a99adfd1caebc9
|
|
| MD5 |
d4e33ef46817a571bfb95b6158a30576
|
|
| BLAKE2b-256 |
98e3f8e6e3d3f98e38b61fffa798e44c19c86fe26f03435756d39413d563a58f
|
Provenance
The following attestation bundles were made for python_switchos-0.0.7.tar.gz:
Publisher:
python-publish.yml on probert94/python-switchos
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_switchos-0.0.7.tar.gz -
Subject digest:
48bab3dada42553a694964d52f7818758371816f1ac16426e6a99adfd1caebc9 - Sigstore transparency entry: 583071377
- Sigstore integration time:
-
Permalink:
probert94/python-switchos@df86892402403ceeeb253d9af149a7bdba5c0d2e -
Branch / Tag:
refs/tags/0.0.7 - Owner: https://github.com/probert94
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@df86892402403ceeeb253d9af149a7bdba5c0d2e -
Trigger Event:
release
-
Statement type:
File details
Details for the file python_switchos-0.0.7-py3-none-any.whl.
File metadata
- Download URL: python_switchos-0.0.7-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b6d8aa39e5b227a00d596365a6947e406868b417d4db756c1d56017eceabece
|
|
| MD5 |
c4615830e8aeda32f6b53fb5f62ff1ac
|
|
| BLAKE2b-256 |
9c87b095f77d0096b0b235c34382139c20b951775bda09e67ae2b008047feb1b
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_switchos-0.0.7-py3-none-any.whl -
Subject digest:
8b6d8aa39e5b227a00d596365a6947e406868b417d4db756c1d56017eceabece - Sigstore transparency entry: 583071389
- Sigstore integration time:
-
Permalink:
probert94/python-switchos@df86892402403ceeeb253d9af149a7bdba5c0d2e -
Branch / Tag:
refs/tags/0.0.7 - Owner: https://github.com/probert94
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@df86892402403ceeeb253d9af149a7bdba5c0d2e -
Trigger Event:
release
-
Statement type: