dartmist
A library for interacting with the Mist Systems API
Requirements
Python libraries
- websocket
- websocket-client
Installation
pip3 install dartmist
Will install this library and all required libraries
Setup
Environment
You must specify a Mist Org ID and a Mist API Token. These can be passed in via the command line (see Usage) or, preferably, set as envinronment variables:
export MIST_ORGID="00000000-0000-0000-0000-000000000000"
export MIST_TOKEN="12345123451234512345123451234512345"
To get an API Token, refer to the documentation provided by Mist https://api.mist.com/api/v1/docs/Auth#api-token
Usage
In your python script:
from dartmist import mist, misthelpers
api = mist.Mist(TOKEN, ORGID)
helper = misthelpers.MistHelpers(api)
To use the MistWebsocket class:
import threading
ev = threading.Event()
mwsock = mistwebsocket.MistWebsocket(TOKEN, ev)
mswock.open()
if ws.is_open:
print("Yes, the Websocket is open")
else:
logging.error("Failed to open Websocket")
exit(-1)
mwsock.subscribe()
while not ev.isSet() and len(ws.messages) == 0:
logging.debug("Waiting...")
msg_rcvd = ev.wait(10)
if msg_rcvd or ev.isSet() or len(ws.messages) > 0:
# Process messages
msg = json.loads(ws.get_next_message())
mwsock.unsubscribe()
mwsock.close()
Metadata
Release files for dartmist 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dartmist-0.1.0.tar.gz | 4.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dartmist-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.1 kB
Release files / dartmist-0.1.0.tar.gz
| Download URL | dartmist-0.1.0.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4805890239e4c3c71d1ff5dd872d4bed8c471c7685137fce710c5cc7830336e1
|
|
BLAKE2b-256 checksum How to use checksums |
8814c1e8d576691f5abfd8be4f155c2e4a7afa9391f85476398d9b4109270d33
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9
|
Release files / dartmist-0.1.0-py3-none-any.whl
| Download URL | dartmist-0.1.0-py3-none-any.whl |
|---|---|
| Size | 33.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7378c2e4b276bffda7a145631d318c2fedfee5dc29e06a767eea6f03d64f3058
|
|
BLAKE2b-256 checksum How to use checksums |
324d4998ca5d5b41ec5629c053b4367d5b0a1158b34d5d4f2d48327e435d3bd6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9
|