{"library":"pyatv","title":"pyatv","description":"A Python client library for controlling Apple TV and AirPlay devices. It supports scanning, pairing, and remote control via MRP, Companion, and AirPlay protocols. Current version 0.17.0 requires Python 3.9+, and releases occur roughly every 3-6 months.","language":"python","status":"active","last_verified":"Fri May 01","install":{"commands":["pip install pyatv"],"cli":{"name":"pyatv","version":"sh: 1: pyatv: not found"}},"imports":["import pyatv","from pyatv import scan","from pyatv import connect","from pyatv import const"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import asyncio\nfrom pyatv import scan, connect\n\nasync def example():\n    devices = await scan(loop=asyncio.get_running_loop(), timeout=5)\n    if not devices:\n        print(\"No Apple TV found\")\n        return\n    atv = devices[0]\n    print(f\"Found: {atv.name} at {atv.address}\")\n    try:\n        conn = await connect(atv, loop=asyncio.get_running_loop())\n        print(\"Connected successfully\")\n        # Example: play/pause\n        await conn.remote_control.play_pause()\n        conn.close()\n    except Exception as e:\n        print(f\"Connection failed: {e}\")\n\nasyncio.run(example())","lang":"python","description":"Scan for Apple TV devices, connect to the first one found, and send a play/pause command.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}