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"}
params = {"sid": "unlockApi", "checkSafeAddress": True}
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
# }
# }
All functions return
Noneon failure. Always check the return value before passing it to the next call.
Utilities
# get account region
region = migate.get_region(pass_token)
# get dataCenterZone
## get with account region
zone = migate.get_dataCenterZone(region) ## get with account ID
zone = migate.get_dataCenterZone(userId) ## manual selection
zone = migate.get_dataCenterZone()
# get uRegion
uRegion = migate.get_uRegion()
# get uLocale
uLocale = migate.get_uLocale()
# areaConfig, ex: with SG
area = migate.get_areaConfig("SG")
# {"code": "SG", "name": "Singapore", "dial": "+65"}
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.5.tar.gz
(14.0 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.5-py3-none-any.whl
(18.2 kB
view details)
File details
Details for the file migate-1.1.5.tar.gz.
File metadata
- Download URL: migate-1.1.5.tar.gz
- Upload date:
- Size: 14.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94fa11506cd834588ea982920bfe80267bfbb585ac44fe4cef1ff30bd9a496f2
|
|
| MD5 |
37f64d291c6b099f37435225ce34dda7
|
|
| BLAKE2b-256 |
0a33be128737e1a9cf989b03b6189a0975c03febbf6a13ed99d65ffdebb14083
|
File details
Details for the file migate-1.1.5-py3-none-any.whl.
File metadata
- Download URL: migate-1.1.5-py3-none-any.whl
- Upload date:
- Size: 18.2 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 |
1782f310a58455ad2260ec1dbe52b989705e9cc2342cee43909103f07831cb65
|
|
| MD5 |
c8d660d709b636a3e70004000df69076
|
|
| BLAKE2b-256 |
bb778863cc66a42df24c793c7fd838ea862b23229014cda621394a21ae428a30
|