Skip to main content
migate

Xiaomi authentication gateway for Python


Version Changelog


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 None on 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"}

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.10.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

migate-1.1.10-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file migate-1.1.10.tar.gz.

File metadata

  • Download URL: migate-1.1.10.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

Hashes for migate-1.1.10.tar.gz
Algorithm Hash digest
SHA256 b3ae9f3d4bb85826a121c9c7d79e0e1c129baa7e58d005b23267bf26701924d5
MD5 00eff69bb8d4737d25c8ee50062d4643
BLAKE2b-256 58d7117238f7d201dd485c912c7025b32f0406293986c06f19efefe6197ba29c

See more details on using hashes here.

Provenance

The following attestation bundles were made for migate-1.1.10.tar.gz:

Publisher: publish-to-pypi.yml on offici5l/migate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file migate-1.1.10-py3-none-any.whl.

File metadata

  • Download URL: migate-1.1.10-py3-none-any.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for migate-1.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 28b4d3ee4c5f27209c8f5d24c877c0bc594eb11817284599232ce06ca3f08dc5
MD5 1c4e098b204f8f690f6e68924b7edb5a
BLAKE2b-256 00d57863855b759525ecc683d74f90bbf4d2824cc4fd19f2a7df4d03053f886d

See more details on using hashes here.

Provenance

The following attestation bundles were made for migate-1.1.10-py3-none-any.whl:

Publisher: publish-to-pypi.yml on offici5l/migate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.1.11

2 files

This release

1.1.10 This release

2 files

1.1.9

2 files

1.1.8

2 files

1.1.7

2 files

1.1.6

2 files

1.1.5

2 files

1.1.4

2 files

1.1.3

2 files

1.1.2

2 files

1.1.1

2 files

1.1.0

2 files

1.0.9

2 files

1.0.8

2 files

1.0.7

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page