TP-Link M7000/M7200 API client and CLI
Project description
TP-Link M7000/M7200 Python API
Small Python client for TP-Link M7000/M7200 MiFi devices. It fetches an auth challenge, encrypts login and follow-up calls with AES/RSA, and exposes handy commands (status, SMS, network mode, mobile data, reboot, arbitrary invokes).
Install
pip install tplink-m7200
Development setup
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install -e .
Optional config file m7200.ini:
[modem]
host=192.168.0.1
username=admin
password=your_password
session_file=m7200.session.json
CLI usage
All commands log in first, then call the modem API. Add -v for debug logs.
# Login and show result/token
m7200 --password YOUR_PASS login
# Status (module=status, action=0)
m7200 --password YOUR_PASS status
# Toggle mobile data (module=wan, action=1)
m7200 --password YOUR_PASS mobile-data on # or off
# Set preferred network mode (module=wan, action=1) | 1=3G only, 2=4G only, 3=4G preferred
m7200 --password YOUR_PASS network-mode 3
# Send SMS (module=message, action=3)
m7200 --password YOUR_PASS send-sms 5555 "INTERNET"
# Read SMS inbox (module=message, action=2)
m7200 --password YOUR_PASS read-sms --page 1 --page-size 8 --box 0
# Current IP (module=status, action=0)
m7200 --password YOUR_PASS ip
m7200 --password YOUR_PASS ip --ipv6
# Data quota/usage (module=status, action=0)
m7200 --password YOUR_PASS quota
m7200 --password YOUR_PASS quota --human
# Reboot (module=reboot, action=0)
m7200 --password YOUR_PASS reboot
# Arbitrary invoke
m7200 --password YOUR_PASS invoke status 0
m7200 --password YOUR_PASS invoke wan 1 --data '{"networkPreferredMode":3}'
Flags --host and --username override config/defaults. Use --session-file (or session_file in
m7200.ini) to cache the session bundle and reuse it on later runs (default: m7200.session.json).
When working from the repo without installing, python m7200.py works directly; use
PYTHONPATH=src python -m tplink_m7200 if you prefer module execution.
Timeout: default 10s; override with --timeout or timeout_seconds in m7200.ini.
Notes
- AES-CBC key/IV are generated per login (numeric strings, 16 chars). RSA is chunked to support the 512-bit modulus the modem returns.
- All requests are plain HTTP to the modem LAN IP (no TLS on the device).
- This client only implements a subset of modules/actions. See the docstring in
m7200.pyfor the full list of known module/action codes.
Project details
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 tplink_m7200-20251222.tar.gz.
File metadata
- Download URL: tplink_m7200-20251222.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
626fe9a1f34cb03d2e7dc8abb9e77feb6bd9c8f73290284205c72df4180802ab
|
|
| MD5 |
bc6885056ba19d6cdabe45fd3866e63e
|
|
| BLAKE2b-256 |
3d239dcf894300bf32d8d9716126c31e1960fe81c350dc182ef45e77b0606f56
|
File details
Details for the file tplink_m7200-20251222-py3-none-any.whl.
File metadata
- Download URL: tplink_m7200-20251222-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4f4898a732770fbd163b15566126ba35e413814f43c0948aab51501506786f9
|
|
| MD5 |
3bd1cb32e92001750b038a731d451c3a
|
|
| BLAKE2b-256 |
c7f4d4976d49fbe25a5c442540d1be4f6be52d3947b04552220a1ecbbd1167eb
|