pytapo


Namepytapo JSON
Version 3.3.19 PyPI version JSON
download
home_pagehttps://github.com/JurajNyiri/pytapo
SummaryPython library for communication with Tapo Cameras
upload_time2024-03-11 11:44:25
maintainer
docs_urlNone
authorJuraj Nyíri
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # PyTapo

Python library for communication with Tapo Cameras

## Install:

```
python3 -m pip install pytapo
```

## Usage examples:

### Initiate library:

```
from pytapo import Tapo

user = "" # user you set in Advanced Settings -> Camera Account
password = "" # password you set in Advanced Settings -> Camera Account
host = "" # ip of the camera, example: 192.168.1.52

tapo = Tapo(host, user, password)

print(tapo.getBasicInfo())
```

## Authentication

Depending on your camera model and firmware version, the authentication method varies.

Normally you should be able to authenticate using the "camera account" created via the Tapo App (Settings > Advanced settings > Camera account).

In case of a similar stack trace:

```
Traceback (most recent call last):
  File "/home/user/Projects/pytapo/pytapo/__init__.py", line 41, in __init__
    self.basicInfo = self.getBasicInfo()
  File "/home/user/Projects/pytapo/pytapo/__init__.py", line 232, in getBasicInfo
    return self.performRequest(
  File "/home/user/Projects/pytapo/pytapo/__init__.py", line 95, in performRequest
    self.ensureAuthenticated()
  File "/home/user/Projects/pytapo/pytapo/__init__.py", line 61, in ensureAuthenticated
    return self.refreshStok()
  File "/home/user/Projects/pytapo/pytapo/__init__.py", line 80, in refreshStok
    raise Exception("Invalid authentication data")
Exception: Invalid authentication data
```

Attempt to authenticate using `admin` as `user` and your TP-Link cloud account password as `password`.

## Downloading Recordings

Integration supports downloading recordings saved on camera's SD card.

See [example script](https://github.com/JurajNyiri/pytapo/blob/main/experiments/DownloadRecordings.py).
You need to call it with following ENV values:

- `HOST`: IP Address of your camera
- `PASSWORD_CLOUD`: Tapo cloud account password, it is required to access the recordings, everything is still local
- `OUTPUT`: Directory where you wish to save all the recordings
- `DATE`: Date for which to download recordings in format of YYYYMMDD, for example 20230221.

You also need to have ffmpeg installed as that is used for converting the streams to watchable file.

## Contributions:

Contributions to pytapo are welcomed.

By creating a PR you acknowledge and agree that you are not breaking any TOS, law and/or have a permission to provide and share the code changes.

Owner of this repository is not legally responsible for any PRs or code changes to this project created by 3rd parties.

When you make a new change to the code base, make sure to have 100% unit test coverage, see below for more information about tests.

### Test instructions

Set the following environment variables:

`PYTAPO_USER` - user you set in Advanced Settings -> Camera Account

`PYTAPO_PASSWORD` - password you set in Advanced Settings -> Camera Account

`PYTAPO_IP` - ip of the camera, example: 192.168.1.52

Install `pre-commit` and `tox` from pip.

Run `pre-commit install` and `pre-commit install -t pre-push`.

Then run `tox` to run all the tests.

Linters are ran on every commit.

Tests are ran on push.

Your camera may do all the actions supported by this library, including, but not limited to, move, change privacy mode and reboot while tests are running. Camera does not format SD card during tests.

After the tests are done, your camera should be in the initial state.

## Thank you

- [Dale Pavey](https://research.nccgroup.com/2020/07/31/lights-camera-hacked-an-insight-into-the-world-of-popular-ip-cameras/) from NCC Group for the initial research on the Tapo C200
- [likaci](https://github.com/likaci) and [his github repository](https://github.com/likaci/mercury-ipc-control) for the research on the Mercury camera on which tapo is based
- [Tim Zhang](https://github.com/ttimasdf) for additional research for Mercury camera on [his github repository](https://github.com/ttimasdf/mercury-ipc-control)
- [Gábor Szabados](https://github.com/GSzabados) for doing research and gathering all the information above in [Home Assistant Community forum](https://community.home-assistant.io/t/use-pan-tilt-function-for-tp-link-tapo-c200-from-home-assistant/170143/18)
- [Davide Depau](https://github.com/Depau) for additional [research](https://md.depau.eu/s/r1Ys_oWoP) of the cameras and work on pytapo library
- [Alex X](https://github.com/AlexxIT) for his incredible work on go2rtc library, and its code for Tapo stream communication which was rewritten to python in order to implement stream-related features of this library

# Disclaimer

Pytapo is an unofficial module for achieving interoperability with Tapo cameras.

Author is in no way affiliated with Tp-Link or Tapo.

All the api requests used within the library are available and published on the internet (examples linked above) and this module is purely just a wrapper around those https requests.

Author does not guarantee functionality of this library and is not responsible for any damage.

All product names, trademarks and registered trademarks in this repository, are property of their respective owners.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/JurajNyiri/pytapo",
    "name": "pytapo",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Juraj Ny\u00edri",
    "author_email": "juraj.nyiri@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/0a/61/2d1841235f6da4c0a035973ca99d88682731fe93663a32046fcc2c59bf04/pytapo-3.3.19.tar.gz",
    "platform": null,
    "description": "# PyTapo\n\nPython library for communication with Tapo Cameras\n\n## Install:\n\n```\npython3 -m pip install pytapo\n```\n\n## Usage examples:\n\n### Initiate library:\n\n```\nfrom pytapo import Tapo\n\nuser = \"\" # user you set in Advanced Settings -> Camera Account\npassword = \"\" # password you set in Advanced Settings -> Camera Account\nhost = \"\" # ip of the camera, example: 192.168.1.52\n\ntapo = Tapo(host, user, password)\n\nprint(tapo.getBasicInfo())\n```\n\n## Authentication\n\nDepending on your camera model and firmware version, the authentication method varies.\n\nNormally you should be able to authenticate using the \"camera account\" created via the Tapo App (Settings > Advanced settings > Camera account).\n\nIn case of a similar stack trace:\n\n```\nTraceback (most recent call last):\n  File \"/home/user/Projects/pytapo/pytapo/__init__.py\", line 41, in __init__\n    self.basicInfo = self.getBasicInfo()\n  File \"/home/user/Projects/pytapo/pytapo/__init__.py\", line 232, in getBasicInfo\n    return self.performRequest(\n  File \"/home/user/Projects/pytapo/pytapo/__init__.py\", line 95, in performRequest\n    self.ensureAuthenticated()\n  File \"/home/user/Projects/pytapo/pytapo/__init__.py\", line 61, in ensureAuthenticated\n    return self.refreshStok()\n  File \"/home/user/Projects/pytapo/pytapo/__init__.py\", line 80, in refreshStok\n    raise Exception(\"Invalid authentication data\")\nException: Invalid authentication data\n```\n\nAttempt to authenticate using `admin` as `user` and your TP-Link cloud account password as `password`.\n\n## Downloading Recordings\n\nIntegration supports downloading recordings saved on camera's SD card.\n\nSee [example script](https://github.com/JurajNyiri/pytapo/blob/main/experiments/DownloadRecordings.py).\nYou need to call it with following ENV values:\n\n- `HOST`: IP Address of your camera\n- `PASSWORD_CLOUD`: Tapo cloud account password, it is required to access the recordings, everything is still local\n- `OUTPUT`: Directory where you wish to save all the recordings\n- `DATE`: Date for which to download recordings in format of YYYYMMDD, for example 20230221.\n\nYou also need to have ffmpeg installed as that is used for converting the streams to watchable file.\n\n## Contributions:\n\nContributions to pytapo are welcomed.\n\nBy creating a PR you acknowledge and agree that you are not breaking any TOS, law and/or have a permission to provide and share the code changes.\n\nOwner of this repository is not legally responsible for any PRs or code changes to this project created by 3rd parties.\n\nWhen you make a new change to the code base, make sure to have 100% unit test coverage, see below for more information about tests.\n\n### Test instructions\n\nSet the following environment variables:\n\n`PYTAPO_USER` - user you set in Advanced Settings -> Camera Account\n\n`PYTAPO_PASSWORD` - password you set in Advanced Settings -> Camera Account\n\n`PYTAPO_IP` - ip of the camera, example: 192.168.1.52\n\nInstall `pre-commit` and `tox` from pip.\n\nRun `pre-commit install` and `pre-commit install -t pre-push`.\n\nThen run `tox` to run all the tests.\n\nLinters are ran on every commit.\n\nTests are ran on push.\n\nYour camera may do all the actions supported by this library, including, but not limited to, move, change privacy mode and reboot while tests are running. Camera does not format SD card during tests.\n\nAfter the tests are done, your camera should be in the initial state.\n\n## Thank you\n\n- [Dale Pavey](https://research.nccgroup.com/2020/07/31/lights-camera-hacked-an-insight-into-the-world-of-popular-ip-cameras/) from NCC Group for the initial research on the Tapo C200\n- [likaci](https://github.com/likaci) and [his github repository](https://github.com/likaci/mercury-ipc-control) for the research on the Mercury camera on which tapo is based\n- [Tim Zhang](https://github.com/ttimasdf) for additional research for Mercury camera on [his github repository](https://github.com/ttimasdf/mercury-ipc-control)\n- [G\u00e1bor Szabados](https://github.com/GSzabados) for doing research and gathering all the information above in [Home Assistant Community forum](https://community.home-assistant.io/t/use-pan-tilt-function-for-tp-link-tapo-c200-from-home-assistant/170143/18)\n- [Davide Depau](https://github.com/Depau) for additional [research](https://md.depau.eu/s/r1Ys_oWoP) of the cameras and work on pytapo library\n- [Alex X](https://github.com/AlexxIT) for his incredible work on go2rtc library, and its code for Tapo stream communication which was rewritten to python in order to implement stream-related features of this library\n\n# Disclaimer\n\nPytapo is an unofficial module for achieving interoperability with Tapo cameras.\n\nAuthor is in no way affiliated with Tp-Link or Tapo.\n\nAll the api requests used within the library are available and published on the internet (examples linked above) and this module is purely just a wrapper around those https requests.\n\nAuthor does not guarantee functionality of this library and is not responsible for any damage.\n\nAll product names, trademarks and registered trademarks in this repository, are property of their respective owners.\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python library for communication with Tapo Cameras",
    "version": "3.3.19",
    "project_urls": {
        "Homepage": "https://github.com/JurajNyiri/pytapo"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "281fb034f44558f6c4cd4d6ceade4b19b229c03a4705690fd9a695900c59ed85",
                "md5": "f542ad5bd96a78013c4a1a7d561e6ac4",
                "sha256": "f8ded339ee59a4e650ec62e8a7dc2caf131193de7a600e4bce85a77eb8095b5d"
            },
            "downloads": -1,
            "filename": "pytapo-3.3.19-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f542ad5bd96a78013c4a1a7d561e6ac4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 32000,
            "upload_time": "2024-03-11T11:44:22",
            "upload_time_iso_8601": "2024-03-11T11:44:22.542812Z",
            "url": "https://files.pythonhosted.org/packages/28/1f/b034f44558f6c4cd4d6ceade4b19b229c03a4705690fd9a695900c59ed85/pytapo-3.3.19-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0a612d1841235f6da4c0a035973ca99d88682731fe93663a32046fcc2c59bf04",
                "md5": "eb6e1346276342ede2d33f3880dc3a9e",
                "sha256": "666fe597abce156d397ae46024df9282156632448641cf42559911bb787a0104"
            },
            "downloads": -1,
            "filename": "pytapo-3.3.19.tar.gz",
            "has_sig": false,
            "md5_digest": "eb6e1346276342ede2d33f3880dc3a9e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 30624,
            "upload_time": "2024-03-11T11:44:25",
            "upload_time_iso_8601": "2024-03-11T11:44:25.193355Z",
            "url": "https://files.pythonhosted.org/packages/0a/61/2d1841235f6da4c0a035973ca99d88682731fe93663a32046fcc2c59bf04/pytapo-3.3.19.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-11 11:44:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "JurajNyiri",
    "github_project": "pytapo",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": false,
    "tox": true,
    "lcname": "pytapo"
}
        
Elapsed time: 0.24867s