MarkGodwin / tplink-omada-api

MIT License
12 stars 9 forks source link

KeyError: 'uplinkMac' when calling `OmadaLink.mac` #28

Closed mheath closed 10 months ago

mheath commented 10 months ago

I just noticed this bug that comes up when running $ omada switch .... The fix is simple. I'll be pushing up a PR shortly. Here's the full stacktrace.

Traceback (most recent call last):
  File "/home/vscode/.local/bin/omada", line 8, in <module>
    sys.exit(main())
  File "/workspaces/tplink-omada-api/src/tplink_omada_client/cli/__init__.py", line 64, in main
    return asyncio.run(args.func(vars(args)))
  File "/usr/local/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/workspaces/tplink-omada-api/src/tplink_omada_client/cli/command_switch.py", line 33, in command_switch
    print(f"- {downlink.mac} {downlink.name}")
  File "/workspaces/tplink-omada-api/src/tplink_omada_client/devices.py", line 146, in mac
    return self._data.get("mac", self._data["uplinkMac"])
KeyError: 'uplinkMac'