{"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":"python","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,"search_vec":"'activ':40 'allow':17 'api':15,52 'autom':54 'bind':9 'client':53 'control':30 'enabl':24 'everi':46 'frequent':43 'interact':19 'librari':6,29,38 'maintain':41 'manag':28 'media':13,31,50 'metadata':34 'playback':32 'plex':12,22,49 'plexapi':1,2 'programmat':18 'provid':8 'python':5 'releas':44 'retriev':33 'server':14,23,51 'task':25 'typic':45 'week':48","created_at":"2026-04-14T01:30:55.176649+00:00","updated_at":"2026-04-16T18:03:45.473956+00:00","problems":[{"fix":"Verify that the `baseurl` (including port, typically `32400`) and the `token` are correct and current. Ensure the Plex Media Server is running and accessible from the machine running the `plexapi` script. Example: `plex = PlexServer('http://YOUR_PLEX_IP:32400', 'YOUR_PLEX_TOKEN')`","cause":"The provided Plex Media Server URL or authentication token is incorrect, expired, or the server is not accessible due to network issues like a firewall or the server being offline.","error":"plexapi.exceptions.Unauthorized: Invalid username/password or token."},{"fix":"Consult the `plexapi` documentation for the correct attribute names and methods for your installed library version. Avoid directly accessing internal attributes (often prefixed with an underscore, like `_baseurl`). If referencing older code, update to match current API usage.","cause":"This error occurs when attempting to access an attribute or call a method that either does not exist on the `PlexServer` object, has been renamed in a different `plexapi` version, or is not a public attribute.","error":"AttributeError: 'PlexServer' object has no attribute 'baseurl'"},{"fix":"First, retrieve the specific media item (e.g., using `plex.library.section('Movies').get('Movie Title')`) and then pass that object to the `playMedia` method. Example: `movie = plex.library.section('Movies').get('Movie Title'); client.playMedia(movie)`","cause":"This error indicates that the `playMedia` method was called without providing the necessary `media` object as an argument. The method expects a media item (like a Movie or Episode object), not just a key.","error":"TypeError: playMedia() missing 1 required positional argument: 'media'"},{"fix":"Double-check the spelling of the search query and the availability of the media in your Plex library. Try broadening the search (e.g., using partial titles) or searching in different library sections to confirm the item's presence. Example: `movies.search(title='Partial Title')`","cause":"This message appears when a search query within a Plex library section does not yield any matching results, possibly due to a typo, incorrect search parameters, or the media not being present.","error":"No results found for {search_query}"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"4.18.2","cli_name":"","cli_version":null,"type":"library","homepage":"https://plexapi.readthedocs.io","github":"https://github.com/pushingkarmaorg/python-plexapi","docs":"https://python-plexapi.readthedocs.io","changelog":null,"pypi":"https://pypi.org/project/plexapi/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["communication","data","http-networking"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-30","next_check":"2026-07-28","install_tag":null}}