diff --git a/README.md b/README.md index a5f25b3..6d92876 100644 --- a/README.md +++ b/README.md @@ -65,11 +65,11 @@ Token: ['UaFHW53RJVYwqXaa7ncPQ'] Logging in... Logged in! User id: 1234567890 Getting linked wearables... -+----------------------------------------------------------------------+ -| ID | ACT | MAC | auth_key | -|-----+-----+-------------------+--------------------------------------| -| 0 | 1 | AB:CD:EF:12:34:56 | 0xa3c10e34e5c14637eea6b9efc06106 | -+----------------------------------------------------------------------+ + +╓───Device 0 +║ MAC: AB:CD:EF:12:34:56, active: Yes +║ Key: 0xa3c10e34e5c14637eea6b9efc06106 +╙──────────── Logged out. ``` @@ -104,12 +104,16 @@ Token: ['ALSG_CLOUDSRV_9B8D87D0EB77C71B45FF73B2266D922B'] Logging in... Logged in! User id: 3000654321 Getting linked wearables... -+----------------------------------------------------------------------+ -| ID | ACT | MAC | auth_key | -|-----+-----+-------------------+--------------------------------------| -| 0 | 1 | 12:34:56:AB:CD:EF | 0x3c10e34e5c1463527579996fa83e6d | -| 1 | 0 | BA:DC:FE:21:43:65 | 0x00 | -+----------------------------------------------------------------------+ + +╓───Device 0 +║ MAC: 12:34:56:AB:CD:EF, active: Yes +║ Key: 0x3c10e34e5c1463527579996fa83e6d +╙──────────── + +╓───Device 1 +║ MAC: BA:DC:FE:21:43:65, active: No +║ Key: 0x00 +╙──────────── Logged out. ``` diff --git a/huami_token.py b/huami_token.py index 630e27b..219d490 100644 --- a/huami_token.py +++ b/huami_token.py @@ -34,8 +34,6 @@ import uuid import requests from rich import box -from rich.console import Console -from rich.table import Table import urls import errors @@ -333,13 +331,6 @@ if __name__ == "__main__": args = parser.parse_args() - console = Console() - table = Table(show_header=True, header_style="bold", box=box.ASCII) - table.add_column("ID", width=3, justify='center') - table.add_column("ACT", width=3, justify='center') - table.add_column("MAC", style="dim", width=17, justify='center') - table.add_column("auth_key", width=45, justify='center') - if args.firmware and not args.bt_keys: parser.error("Can not use -f/--firmware without -b/--bt_keys!") @@ -355,10 +346,13 @@ if __name__ == "__main__": wearables = [] if args.bt_keys or args.all: wearables = device.get_wearables() + footer = "\u2559" + "\u2500" * 12 for idx, wearable in enumerate(wearables): - table.add_row(str(idx), wearable['active_status'], - wearable['mac_address'], wearable['auth_key']) - console.print(table) + print(f"\n\u2553\u2500\u2500\u2500Device {idx}") + is_active = "Yes" if wearable['active_status'] == '1' else "No" + print(f"\u2551 MAC: {wearable['mac_address']}, active: {is_active}") + print(f"\u2551 Key: {wearable['auth_key']}") + print(footer) if args.firmware: print("Downloading the firmware is untested and can brick your device. " diff --git a/requirements.txt b/requirements.txt index f5ba445..ba7e185 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ requests -rich pytest-pylint==0.18.0 pytest-flake8==1.0.6