python-tapo-local
Client for TP-Link Tapo cameras built from reverse engineering the official Tapo Android app (3.22.304). It talks to the camera on the local network using the same methods and payloads as the app, and it can optionally use the TP-Link cloud (app API v2) for push notifications.
It powers the Tapo Local Home Assistant integration.
pip install python-tapo-local
Local
from tapolocal import TapoLocal
cam = TapoLocal("192.168.1.50", "<TP-Link account password>") # login: admin + cloud password
info = cam.device_info() # model, firmware, MAC, alias
data = cam.fetch() # ~44 getters + 24h detection history + today's recordings
cam.call("setLedStatus", {"led": {"config": {"enabled": "off"}}})
- Transport comes from pytapo (
securePassthrough). On top of it, this library adds the app's method catalog and request shapes. - Requests are batched through
multipleRequest. Methods the firmware doesn't support (-40209) are skipped. - Login is attempted at most twice per call. Every wrong password counts toward the
camera's 30‑minute lockout, so
TapoAuthErroris raised and it never loops. Errors that carry a camera error code (for example-40214when a C200 v3 is busy) keep the session alive instead of logging in again. - Writes use
set<X> {module: {section: {field: value}}}, the same shape as the matching getter. Some C200 quirks:setDayNightModeConfigrequires"chn_id": ["1"],setFirmwareAutoUpgradeConfigrequirestimeandrandom_range, brightness is only accepted throughsetImageLumaConfig, and the siren only takes the legacy{"method": "do", "msg_alarm": {"manual_msg_alarm": …}}(seeTapoLocal.legacy). tapolocal.EVENT_TYPESmaps everyalarm_typefrom the app'sPlayBackEventTypeenum.
Cloud (optional)
import aiohttp
from tapolocal import TapoCloud, TapoMFARequired
async with aiohttp.ClientSession() as s:
cloud = TapoCloud(s, "you@example.com", "password")
try:
await cloud.login()
except TapoMFARequired as mfa:
await cloud.send_mfa_email()
await cloud.check_mfa(mfa.process_id, input("code: "))
cameras = await cloud.devices()
notes = await cloud.notifications(hours=24)
- Requests are signed exactly like the app's
m7/rinterceptor:X-Authorization: Timestamp=9999999999, Nonce=…, AccessKey=…, Signature=HMAC-SHA1(...). getAppNotificationByPageonly returns data withdirection: "asc"starting atindexTime.getDeviceMsgsByPageexists in the API, but the app never calls it and it always comes back empty.- TLS is verified against the two TP-Link root CAs that the app itself bundles.
Development
uv run --with pytest --with pytest-asyncio --with-editable . pytest
Metadata
Release files for python-tapo-local 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python_tapo_local-0.1.0.tar.gz | 11.7 kB | Without provenance | Details for python_tapo_local-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_tapo_local-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for python_tapo_local-0.1.0-py3-none-any.whl |
Total release size: 23.3 kB
Release files / python_tapo_local-0.1.0.tar.gz
| Download URL | python_tapo_local-0.1.0.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dab65be6fe28ee368c9c8d9f16e0ccfd9ae4d9d38400967985f302f0cb284b01
|
|
BLAKE2b-256 checksum How to use checksums |
52c45032e164afd76aae81df3efbc95e9cd103dd14e4523dd89bbee39b8e966d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.5
|
Release files / python_tapo_local-0.1.0-py3-none-any.whl
| Download URL | python_tapo_local-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b0fe4c46e1fb4d36e45f4ab469256eaf749092315c5d27bd98d5fcb4f64e2a08
|
|
BLAKE2b-256 checksum How to use checksums |
faf28824a3cfe8d351e0ef2f206f9ca3e6d11370199dcc6dbc537042bf0f4829
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.5
|
Security for python-tapo-local 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.