The Python SDK
A thin, typed Python client over the same REST API the Studio UI and the CLI both use - the netplex. equivalent of GNS3's gns3fy. No raw requests calls or hand-rolled auth headers; call .create_lab(), .add_node(), .add_link() and get back plain dicts.
Every call below was run against a live instance before this page was published: a lab was created, a node added, host stats and topology read back, and the lab deleted - cleanly, nothing left behind.
Install:
pip install netplex-sdk # from a release pip install -e sdk/python # from the repo, for development
Quickstart:
from netplex_sdk import NetplexClient
fx = NetplexClient("http://localhost:8088", username="admin", password="adminadmin")
fx.login()
lab = fx.create_lab("ci-smoke", description="created by the SDK")
r1 = fx.add_node(lab["id"], "R1", type="docker", vendor="linux", image="alpine:latest", ram=256)
r2 = fx.add_node(lab["id"], "R2", type="docker", vendor="linux", image="alpine:latest", ram=256)
fx.add_link(lab["id"], r1["id"], r2["id"])
print("host RAM free:", fx.host_stats()["mem_available_mb"], "MB")
print("topology:", fx.get_topology(lab["id"]))
fx.delete_lab(lab["id"])
Full method list: login() · me() · list_labs() · create_lab() · get_lab() · delete_lab() · start_lab() · stop_lab() · lab_status() · get_topology() · add_node() · add_link() · host_stats() · license() · health()
Errors raise NetplexError(status, detail) - catch that one exception type rather than parsing HTTP status codes by hand. See docs/api-reference.md in the repo for the full REST surface every method calls under the hood, and "REST API quickstart" if you'd rather skip the SDK and call the endpoints directly.