{"id":5370,"library":"plexapi","title":"PlexAPI","description":"PlexAPI is a Python library that provides bindings for the Plex Media Server API. It allows programmatic interaction with your Plex server, enabling tasks such as managing libraries, controlling media playback, retrieving metadata, and more. The library is actively maintained, with frequent releases, typically every few weeks.","status":"active","version":"4.18.1","language":"en","source_language":"en","source_url":"https://github.com/pushingkarmaorg/python-plexapi","tags":["plex","media server","api client","automation"],"install":[{"cmd":"pip install plexapi","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Used for HTTP requests to the Plex API.","package":"requests"},{"reason":"Provides caching utilities for API responses.","package":"cachetools"},{"reason":"Used for real-time communication with Plex clients and server.","package":"websocket-client"}],"imports":[{"symbol":"PlexServer","correct":"from plexapi.server import PlexServer"}],"quickstart":{"code":"import os\nfrom plexapi.server import PlexServer\n\n# Replace with your Plex URL and token, or set as environment variables\n# Example: PLEX_URL='http://your_plex_ip:32400', PLEX_TOKEN='YOUR_PLEX_TOKEN'\nPLEX_URL = os.environ.get('PLEX_URL', 'http://localhost:32400') # Default for local access\nPLEX_TOKEN = os.environ.get('PLEX_TOKEN', 'YOUR_PLEX_TOKEN') # Get from Plex settings > Network > Show Advanced > token\n\ntry:\n    plex = PlexServer(PLEX_URL, PLEX_TOKEN)\n    print(f\"Connected to Plex server: {plex.friendlyName}\")\n\n    # List all libraries\n    print(\"\\nLibraries:\")\n    for section in plex.library.sections():\n        print(f\"- {section.title} ({section.type})\")\n\n    # Example: Find a movie in a 'Movies' library\n    # Adjust 'Movies' to the actual name of your movie library\n    try:\n        movies_library = plex.library.section('Movies')\n        inception_movie = movies_library.get('Inception')\n        print(f\"\\nFound movie: {inception_movie.title} ({inception_movie.year})\")\n    except Exception as e:\n        print(f\"\\nCould not find 'Movies' library or 'Inception': {e}\")\n\nexcept Exception as e:\n    print(f\"Error connecting to Plex or performing operations: {e}\")\n    print(\"Please ensure PLEX_URL and PLEX_TOKEN are correctly configured in environment variables or directly in the script.\")\n","lang":"python","description":"Connects to a Plex Media Server using provided URL and token, then lists available libraries and demonstrates how to find a specific media item."},"warnings":[{"fix":"Upgrade your Python environment to version 3.10 or later.","message":"PlexAPI now requires Python 3.10 or newer. Earlier Python versions are no longer supported.","severity":"breaking","affected_versions":">=4.18.0"},{"fix":"Review your code for usage of methods marked as deprecated in earlier versions. Consult the PlexAPI documentation or GitHub releases for alternative or updated methods.","message":"All previously deprecated methods have been removed.","severity":"breaking","affected_versions":">=4.18.0"},{"fix":"Rely on the token provided during `PlexServer` instantiation. If interacting with local server accounts, avoid directly accessing `authToken` from the account object.","message":"The `authToken` attribute has been removed from local server account objects. Direct access to this attribute is no longer available.","severity":"breaking","affected_versions":">=4.18.0"},{"fix":"Update your code to call `Hub.items()` instead of accessing `Hub.items` as a property (e.g., `hub.items` -> `hub.items()`).","message":"The `Hub.items` property has been changed to a `Hub.items()` method.","severity":"breaking","affected_versions":">=4.17.0"},{"fix":"Before checking `mediaPart.exists` or `mediaPart.accessible`, call `mediaPart.reload(checkFiles=True)`.","message":"Accessing `MediaPart.exists` and `MediaPart.accessible` attributes now requires explicitly reloading the `MediaPart` object with `checkFiles=True` to ensure up-to-date status.","severity":"gotcha","affected_versions":">=4.15.16"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}