Read now works, and terraform directory contains example code
This commit is contained in:
1 parent
ef498e4a72
commit
a6f1019175
43 files changed
+4341
-38
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import json
|
||||
|
||||
import switch_client
|
||||
import todo
|
||||
from extractors.xe_page import fetch_all_tables
|
||||
|
||||
PATH = "/FDBSearch.html"
|
||||
|
||||
|
||||
def get_mac_table(session) -> dict:
|
||||
"""Returns {"summary": {...}, "entries": [...]}.
|
||||
|
||||
The per-entry table on this page has no <CAPTION> (just an empty one),
|
||||
so it can't be looked up by caption like other pages -- fetch_all_tables()
|
||||
+ table id "1_1" is used instead."""
|
||||
tables = fetch_all_tables(session, PATH)
|
||||
summary = next(t["record"] for t in tables if t.get("caption") == "MAC Table")
|
||||
entries = next(t["rows"] for t in tables if t.get("id") == "1_1")
|
||||
return {"summary": summary, "entries": entries}
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
session = switch_client.get_session()
|
||||
print(json.dumps(get_mac_table(session), indent=2))
|
||||
todo.mark_implemented(switch_client.BASE_URL + PATH)
|
||||
Reference in new issue
Block a user