25 lines
820 B
Python
25 lines
820 B
Python
import json
|
|
|
|
import switch_client
|
|
import todo
|
|
from extractors.xe_page import fetch_tables
|
|
|
|
PATH = "/dual_image_status.html"
|
|
|
|
|
|
def get_dual_image_status(session) -> list[dict]:
|
|
"""Returns one dict per unit (Active image, Next-Active image).
|
|
|
|
Note: the page also has a "Dual Image Descriptions" table (per-image
|
|
version/description) that uses a header shape (TD.tableHeaderright +
|
|
plain TD.defright rows, no defleft labels) our generic scalar/tabular
|
|
parser doesn't handle -- skipped for now, not needed for this data."""
|
|
tables = fetch_tables(session, PATH)
|
|
return tables["Dual Image Status"]["rows"]
|
|
|
|
|
|
if __name__ == "__main__":
|
|
session = switch_client.get_session()
|
|
print(json.dumps(get_dual_image_status(session), indent=2))
|
|
todo.mark_implemented(switch_client.BASE_URL + PATH)
|