Lenovo LMSA ROM Downloader — download firmware from official Lenovo servers
Project description
lmsadwl
Download firmware from official Lenovo servers (LMSA / Software Fix API).
pip install lmsadwl
Commands
lmsadwl login # OAuth2 login via Lenovo Passport
lmsadwl login --url URL # complete login with redirect URL
lmsadwl login --token TOKEN # save token directly
lmsadwl lookup --sn HA1CQ8SV # firmware by serial number
lmsadwl lookup --imei 123456789012345 [--model-code X] [--ro-carrier Y]
lmsadwl search --model x606 # search ROMs by keyword
lmsadwl download --model TB-X606X [-o ./download]
lmsadwl batch --model x606 --limit 5
lmsadwl models [-f moto] [-r] # list supported devices
lmsadwl device # show ADB device info
lmsadwl auto # detect device + find firmware
lmsadwl status # token info and expiry
lmsadwl shell # interactive menu
Python API
from lmsadwl import LMSAClient
client = LMSAClient()
# login
url, state = client.login_interactive()
print(url)
redirect = input("Paste redirect URL: ")
client.login_with_url(redirect)
# search
roms = client.search_roms("x606")
for rom in roms:
print(rom.name, rom.uri)
# lookup by serial
result = client.lookup_by_sn("HA1CQ8SV")
if result.found:
print(result.roms[0].name, result.roms[0].uri)
# auto-detect (requires adb)
device, roms = client.auto_detect()
if device:
print(device.title, device.serial)
# models
models = client.get_models(keyword="moto", read_only=True)
for m in models:
print(m.model_name, m.market_name)
# IMEI lookup
result = client.lookup_by_imei("123456789012345")
Auto-relogin
def relogin():
url, _ = client.login_interactive()
print(f"Open: {url}")
redirect = input("Paste URL: ")
return client.login_with_url(redirect)
client.set_relogin_callback(relogin)
# API calls will auto-relogin on 403/408/402
Models
from lmsadwl import LMSAClient, TokenManager, OAuth2Flow
from lmsadwl import DeviceInfo, ROMInfo
from lmsadwl import is_valid_sn, is_valid_imei
from lmsadwl import parse_jwt, jwt_is_expired, jwt_time_left
LMSAClient(token_dir=None, auto_relogin=True, max_retries=2)
| Method | Returns |
|---|---|
login_interactive() |
(url, state) |
login_with_url(redirect_url) |
bool |
login_with_token(token) |
None |
ensure_auth() |
str (token) |
set_relogin_callback(fn) |
None |
get_rom_list() |
list[ROMInfo] |
search_roms(keyword) |
list[ROMInfo] |
get_models(keyword="", read_only=False) |
list[ModelInfo] |
lookup_by_sn(sn) |
LookupResult |
lookup_by_imei(imei, model_code=None, carrier=None) |
LookupResult |
auto_detect() |
(DeviceInfo, list[ROMInfo]) |
get_rom_match(model_name) |
dict | None |
ROMInfo
| Field | Type |
|---|---|
name |
str |
uri |
str |
md5 |
str |
rom_type |
int |
publish_date |
str |
flash_flow |
str |
rom_match_id |
str |
LookupResult
| Property | Type |
|---|---|
found |
bool |
rescue_available |
bool |
roms |
list[ROMInfo] |
code |
str |
desc |
str |
ModelInfo
| Field | Type |
|---|---|
category |
str |
brand |
str |
model_name |
str |
market_name |
str |
platform |
str |
read_support |
bool |
DeviceInfo
| Field | Type |
|---|---|
serial |
str |
model |
str |
brand |
str |
fingerprint |
str |
incremental |
str |
title |
str (property) |
Utils
is_valid_sn(sn) # bool — 8 alphanumeric chars, no I/O/L
is_valid_imei(imei) # bool — 14-15 digits
parse_jwt(token) # dict | None — decode JWT payload
jwt_is_expired(token, margin=300) # bool
jwt_time_left(token) # float — seconds until expiry
Token
Stored in ~/.lmsadwl/token.json. Auto-refreshes on API errors. Migrates from .lmsa_tokens.json.
License
MIT
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
lmsadwl-1.0.2.tar.gz
(18.5 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
lmsadwl-1.0.2-py3-none-any.whl
(19.6 kB
view details)
File details
Details for the file lmsadwl-1.0.2.tar.gz.
File metadata
- Download URL: lmsadwl-1.0.2.tar.gz
- Upload date:
- Size: 18.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78ded465f9a598865f507dac3f0ee523ab2c4d985e0f7e27d95cdc7fd8f4765e
|
|
| MD5 |
1e414588d979a7b20dcd93a82aae7a66
|
|
| BLAKE2b-256 |
ec8ad8fcd27c26ff9cabd924f54a03b35f62c0a37dc3629a7ea12a12ed074ff3
|
File details
Details for the file lmsadwl-1.0.2-py3-none-any.whl.
File metadata
- Download URL: lmsadwl-1.0.2-py3-none-any.whl
- Upload date:
- Size: 19.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
214ddbfff0cce71679a6853e893118c8475c4451b25e7c519da5397f1ee23be9
|
|
| MD5 |
2c286fa045a92459c54563234f8a33b7
|
|
| BLAKE2b-256 |
cfdbe5ee79ee95fa2dcc6d32cbb3492ff03609da25cbb93fd9b85116a35334fc
|