initial commit

This commit is contained in:
Joachim Friberg committed 2026-08-25 14:10:21 +02:00
1 parent af59a90c31
commit ef498e4a72
114 files changed
+11047

No files matched your search

View File
Whitespace-only changes.
+28
View File
@@ -0,0 +1,28 @@
import sys
import switch_client
from extractors.xe_page import fetch_tables
PATH = "/locator.html"
def get_locator_state(session) -> str:
"""Returns "Enable" or "Disable"."""
tables = fetch_tables(session, PATH)
return tables["Locator Configuration"]["record"]["Locate"]
def set_locator(session, enabled: bool) -> None:
tables = fetch_tables(session, PATH)
field_name = tables["Locator Configuration"]["field_names"]["Locate"]
switch_client.submit_form(session, PATH, {field_name: "Enable" if enabled else "Disable"})
if __name__ == "__main__":
if len(sys.argv) != 2 or sys.argv[1] not in ("on", "off"):
print("usage: python -m actions.locator on|off")
raise SystemExit(1)
session = switch_client.get_session()
set_locator(session, sys.argv[1] == "on")
print("Locator state now:", get_locator_state(session))