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)
# skip the interactive prompt if already logged in
# pass_token = migate.get_passtoken(params, silent=True)
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
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
File details
Details for the file migate-1.1.9.tar.gz.
File metadata
- Download URL: migate-1.1.9.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d61439cfa6991d5ce93730a44935b9356762c9731e39e0117d65af50471d13c9
|
|
| MD5 |
02fc844d0303ecb20d549e78c7dc9c14
|
|
| BLAKE2b-256 |
17b5f6901f6f714d0078f252adadd3fcedeb402ece85e49637f093e800d6a58b
|
Provenance
The following attestation bundles were made for migate-1.1.9.tar.gz:
Publisher:
publish-to-pypi.yml on offici5l/migate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
migate-1.1.9.tar.gz -
Subject digest:
d61439cfa6991d5ce93730a44935b9356762c9731e39e0117d65af50471d13c9 - Sigstore transparency entry: 2238334841
- Sigstore integration time:
-
Permalink:
offici5l/migate@17e1fec0043816e89869beb6105f1e8bbea4099d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/offici5l
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@17e1fec0043816e89869beb6105f1e8bbea4099d -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file migate-1.1.9-py3-none-any.whl.
File metadata
- Download URL: migate-1.1.9-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36ecfe04f9d539d1233ad6f90fdab460e7c441767af8235568136b9566aa11dc
|
|
| MD5 |
c44f824c5414030caee36161cf228d78
|
|
| BLAKE2b-256 |
80aea7ea3ff3a15774c1e351fb67b0f87514b8fb88135b61113fd9e3bbab4436
|
Provenance
The following attestation bundles were made for migate-1.1.9-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on offici5l/migate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
migate-1.1.9-py3-none-any.whl -
Subject digest:
36ecfe04f9d539d1233ad6f90fdab460e7c441767af8235568136b9566aa11dc - Sigstore transparency entry: 2238334902
- Sigstore integration time:
-
Permalink:
offici5l/migate@17e1fec0043816e89869beb6105f1e8bbea4099d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/offici5l
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@17e1fec0043816e89869beb6105f1e8bbea4099d -
Trigger Event:
workflow_dispatch
-
Statement type: