PyTapo: Tapo Camera Communication Library

3.4.13 · active · verified Thu Apr 16

PyTapo is an unofficial Python library designed for communication with Tapo Cameras. It facilitates interoperability by wrapping HTTP requests used to control and retrieve data from Tapo devices. The library is actively maintained, currently at version 3.4.13, and receives regular updates focused on bug fixes, performance enhancements, and support for new camera features such as dual-cam linkage.

Common errors

Warnings

Install

Imports

Quickstart

Initialize the `Tapo` class with your camera's IP address, username, and password, then retrieve basic device information. Ensure you use the 'Camera Account' credentials set up in the Tapo mobile application.

import os
from pytapo import Tapo

# It's recommended to store sensitive information in environment variables.
host = os.environ.get('TAPO_CAMERA_HOST', '192.168.1.100') # Replace with your camera's IP
user = os.environ.get('TAPO_CAMERA_USER', 'camera_username') # Camera Account username from Tapo App
password = os.environ.get('TAPO_CAMERA_PASSWORD', 'camera_password') # Camera Account password from Tapo App

try:
    tapo = Tapo(host, user, password)
    basic_info = tapo.getBasicInfo()
    print(f"Successfully connected to Tapo camera {host}.")
    print(f"Device Name: {basic_info['device_name']}")
    print(f"Device ID: {basic_info['device_id']}")
except Exception as e:
    print(f"Failed to connect to Tapo camera: {e}")
    print("Please ensure the host, username, and password are correct.")
    print("For authentication, use the 'Camera Account' created in the Tapo App (Settings > Advanced settings > Camera account).")

view raw JSON →