migate is a simplified Xiaomi authentication gateway for Python projects
Project description
Install
pip install migate
Or add it as a dependency in your project:
# pyproject.toml
dependencies = ["migate"]
# requirements.txt
migate
Usage
import migate
# --- passport (default) ---
# If no params are passed, sid defaults to passport.
# pass_token = migate.get_passtoken()
# service = migate.get_service(pass_token)
# --- unlockApi: bootloader unlock ---
# params = {"sid": "unlockApi", "checkSafeAddress": True}
# --- xiaomiio: Mi Home / smart home devices ---
# params = {"sid": "xiaomiio"}
# --- micoapi: Mi AI speaker ---
# params = {"sid": "micoapi"}
# --- i.mi.com: Mi Cloud / Find Device ---
# params = {"sid": "i.mi.com"}
# --- 18n_bbs_global: Mi Community ---
# params = {"sid": "18n_bbs_global"}
pass_token = migate.get_passtoken(params)
service = migate.get_service(pass_token, params)
print(pass_token)
# {
# "deviceId": "wb_...",
# "passToken": "...",
# "userId": "..."
# }
print(service)
# {
# "servicedata": {
# "nonce": ...,
# "ssecurity": "...",
# "cUserId": "...",
# "psecurity": "...",
# "deviceId": "wb_..."
# },
# "cookies": {
# # passport -> {}
# # unlockApi -> serviceToken, unlockApi_slh, unlockApi_ph, userId
# # xiaomiio -> serviceToken, cUserId, userId
# # micoapi -> serviceToken, micoapi_slh, micoapi_ph, userId
# # i.mi.com -> serviceToken, i.mi.com_slh, i.mi.com_ph, userId
# # 18n_bbs_global -> serviceToken, popRunToken, new_bbs_serviceToken, new_login, userId
# }
# }
Region detection
import migate
pass_token = migate.get_passtoken()
region = migate.get_region(pass_token) # e.g. "EU"
region_config = migate.get_regionConfig(region) # e.g. "Europe"
Login
On first run, get_passtoken prompts:
1 - Browser (default)
2 - Terminal
3 - QR code
The session is saved at ~/.{sid}/cookies.json and reused automatically on the next run
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
migate-1.1.4.tar.gz
(13.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
migate-1.1.4-py3-none-any.whl
(16.5 kB
view details)
File details
Details for the file migate-1.1.4.tar.gz.
File metadata
- Download URL: migate-1.1.4.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03305d5a9789012f4f9ecd41c22f777168dc9f34c4c2eb69e9092234b2729372
|
|
| MD5 |
9eb464b98a3405d9f97c1a80c743ff5a
|
|
| BLAKE2b-256 |
d296ab5c22a020f3b0573faa6980ca0dd5f0756c7ba6d864b28824f9d69bc5cd
|
File details
Details for the file migate-1.1.4-py3-none-any.whl.
File metadata
- Download URL: migate-1.1.4-py3-none-any.whl
- Upload date:
- Size: 16.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0d253eb2c8343b27ad2d8b33fbd002ca7967201c079f61efd04af7e3afbef7e
|
|
| MD5 |
d588580b49ef752978b1a46b72f4598b
|
|
| BLAKE2b-256 |
561c407e7296776824c1abe12eee834f0c386b9c74f7bf764ab77fb65b72893c
|