diff --git a/.gitignore b/.gitignore index 8ca53a7..15cd0bd 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ notebooks .idea .DS_Store *.zip -__pycache__ \ No newline at end of file +__pycache__ +*.dump diff --git a/README.md b/README.md index 664eb2a..42526eb 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,30 @@ Huami servers. 3. Clone this repo: ```git clone https://github.com/argrento/huami-token.git``` +## Usage +``` +usage: huami_token.py [-h] -m {amazfit,xiaomi} [-e EMAIL] [-p PASSWORD] [-b] + [-g] [-a] [-n] + +Obtain Bluetooth Auth key from Amazfit servers and download AGPS data. + +optional arguments: + -h, --help show this help message and exit + -m {amazfit,xiaomi}, --method {amazfit,xiaomi} + Login method + -e EMAIL, --email EMAIL + Account e-mail address + -p PASSWORD, --password PASSWORD + Account Password + -b, --bt_keys Get bluetooth tokens of paired devices + -g, --gps Download A-GPS files + -a, --all Do everything: get bluetooth tokens, download A-GPS + files + -n, --no_logout Do not logout, keep active session and display app + token and access token +``` + + ## Logging in with Amazfit account Run script with your cridentials: `python huami_token.py --method amazfit --email youemail@example.com --password your_password --bt_keys`. diff --git a/huami_token.py b/huami_token.py index af7a48d..2b75715 100644 --- a/huami_token.py +++ b/huami_token.py @@ -239,7 +239,7 @@ if __name__ == "__main__": console = Console() table = Table(show_header=True, header_style="bold", box=box.ASCII) table.add_column("MAC", style="dim", width=17, justify='center') - table.add_column("auth_key", width=36, justify='center') + table.add_column("auth_key", width=50, justify='center') device = HuamiAmazfit(method=args.method, email=args.email, diff --git a/urls.py b/urls.py index 69cf426..8836b6d 100644 --- a/urls.py +++ b/urls.py @@ -6,6 +6,7 @@ URLS = { 'login_amazfit': 'https://account.huami.com/v2/client/login', 'devices': 'https://api-mifit-us2.huami.com/users/{user_id}/devices', 'agps': 'https://api-mifit-us2.huami.com/apps/com.huami.midong/fileTypes/{pack_name}/files', + 'data_short': 'https://api-mifit-us2.huami.com/users/{user_id}/deviceTypes/4/data', 'logout': 'https://account-us2.huami.com/v1/client/logout' } @@ -41,6 +42,11 @@ PAYLOADS = { 'agps': { 'apptoken': None }, + 'data_short': { + 'apptoken': None, + 'startDay': None, + 'endDay': None + }, 'logout': { 'login_token': None },