{"id":26665199,"url":"https://github.com/pushingkarmaorg/python-plexapi","last_synced_at":"2026-04-08T14:32:43.767Z","repository":{"id":25155097,"uuid":"28577719","full_name":"pushingkarmaorg/python-plexapi","owner":"pushingkarmaorg","description":"Python bindings for the Plex API.","archived":false,"fork":false,"pushed_at":"2026-03-31T11:03:00.000Z","size":32721,"stargazers_count":1273,"open_issues_count":62,"forks_count":199,"subscribers_count":34,"default_branch":"master","last_synced_at":"2026-04-01T10:39:35.092Z","etag":null,"topics":["api","plex","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pushingkarmaorg.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.txt","dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2014-12-29T02:38:06.000Z","updated_at":"2026-03-30T04:54:52.000Z","dependencies_parsed_at":"2023-10-25T12:58:07.225Z","dependency_job_id":"2921a991-998a-4202-b66f-5979d5be3b42","html_url":"https://github.com/pushingkarmaorg/python-plexapi","commit_stats":{"total_commits":2192,"total_committers":93,"mean_commits":23.56989247311828,"dds":0.7121350364963503,"last_synced_commit":"2ed7702e6f461efae7faa4349db1922de1546492"},"previous_names":["pushingkarmaorg/python-plexapi","mjs7231/plexapi"],"tags_count":72,"template":false,"template_full_name":null,"purl":"pkg:github/pushingkarmaorg/python-plexapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pushingkarmaorg%2Fpython-plexapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pushingkarmaorg%2Fpython-plexapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pushingkarmaorg%2Fpython-plexapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pushingkarmaorg%2Fpython-plexapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pushingkarmaorg","download_url":"https://codeload.github.com/pushingkarmaorg/python-plexapi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pushingkarmaorg%2Fpython-plexapi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31559818,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","plex","python"],"created_at":"2025-03-25T17:13:29.245Z","updated_at":"2026-04-08T14:32:43.747Z","avatar_url":"https://github.com/pushingkarmaorg.png","language":"Python","readme":"Python-PlexAPI\n==============\n.. image:: https://github.com/pushingkarmaorg/python-plexapi/actions/workflows/ci.yaml/badge.svg\n    :target: https://github.com/pushingkarmaorg/python-plexapi/actions/workflows/ci.yaml\n.. image:: https://readthedocs.org/projects/python-plexapi/badge/?version=latest\n    :target: http://python-plexapi.readthedocs.io/en/latest/?badge=latest\n.. image:: https://codecov.io/gh/pushingkarmaorg/python-plexapi/branch/master/graph/badge.svg?token=fOECznuMtw\n    :target: https://codecov.io/gh/pushingkarmaorg/python-plexapi\n.. image:: https://img.shields.io/github/tag/pushingkarmaorg/python-plexapi.svg?label=github+release\n    :target: https://github.com/pushingkarmaorg/python-plexapi/releases\n.. image:: https://badge.fury.io/py/PlexAPI.svg\n    :target: https://badge.fury.io/py/PlexAPI\n.. image:: https://img.shields.io/github/last-commit/pushingkarmaorg/python-plexapi.svg\n    :target: https://img.shields.io/github/last-commit/pushingkarmaorg/python-plexapi.svg\n\n\nOverview\n--------\nUnofficial Python bindings for the Plex API. Our goal is to match all capabilities of the official\nPlex Web Client. A few of the many features we currently support are:\n\n* Navigate local or remote shared libraries.\n* Perform library actions such as scan, analyze, empty trash.\n* Remote control and play media on connected clients, including `Controlling Sonos speakers`_\n* Listen in on all Plex Server notifications.\n \n\nInstallation \u0026 Documentation\n----------------------------\n\n.. code-block:: python\n\n    pip install plexapi\n\n*Install extra features:*\n\n.. code-block:: python\n\n    pip install plexapi[alert]  # Install with dependencies required for plexapi.alert\n    pip install plexapi[jwt]    # Install with dependencies required for Plex JWT authentication\n\nDocumentation_ can be found at Read the Docs.\n\n.. _Documentation: http://python-plexapi.readthedocs.io/en/latest/\n\nJoin our Discord_ for support and discussion.\n\n.. _Discord: https://discord.gg/GtAnnZAkuw\n\n\nGetting a PlexServer Instance\n-----------------------------\n\nThere are two types of authentication. If you are running on a separate network\nor using Plex Users you can log into MyPlex to get a PlexServer instance. An\nexample of this is below. NOTE: Servername below is the name of the server (not\nthe hostname and port).  If logged into Plex Web you can see the server name in\nthe top left above your available libraries.\n\n.. code-block:: python\n\n    from plexapi.myplex import MyPlexAccount\n    account = MyPlexAccount('\u003cUSERNAME\u003e', '\u003cPASSWORD\u003e')\n    plex = account.resource('\u003cSERVERNAME\u003e').connect()  # returns a PlexServer instance\n\nIf you want to avoid logging into MyPlex and you already know your auth token\nstring, you can use the PlexServer object directly as above, by passing in\nthe baseurl and auth token directly.\n\n.. code-block:: python\n\n    from plexapi.server import PlexServer\n    baseurl = 'http://plexserver:32400'\n    token = '2ffLuB84dqLswk9skLos'\n    plex = PlexServer(baseurl, token)\n\n\nUsage Examples\n--------------\n\n.. code-block:: python\n\n    # Example 1: List all unwatched movies.\n    movies = plex.library.section('Movies')\n    for video in movies.search(unwatched=True):\n        print(video.title)\n\n\n.. code-block:: python\n\n    # Example 2: Mark all Game of Thrones episodes as played.\n    plex.library.section('TV Shows').get('Game of Thrones').markPlayed()\n\n\n.. code-block:: python\n\n    # Example 3: List all clients connected to the Server.\n    for client in plex.clients():\n        print(client.title)\n\n\n.. code-block:: python\n\n    # Example 4: Play the movie Cars on another client.\n    # Note: Client must be on same network as server.\n    cars = plex.library.section('Movies').get('Cars')\n    client = plex.client(\"Michael's iPhone\")\n    client.playMedia(cars)\n\n\n.. code-block:: python\n\n    # Example 5: List all content with the word 'Game' in the title.\n    for video in plex.search('Game'):\n        print(f'{video.title} ({video.TYPE})')\n\n\n.. code-block:: python\n\n    # Example 6: List all movies directed by the same person as Elephants Dream.\n    movies = plex.library.section('Movies')\n    elephants_dream = movies.get('Elephants Dream')\n    director = elephants_dream.directors[0]\n    for movie in movies.search(None, director=director):\n        print(movie.title)\n\n\n.. code-block:: python\n\n    # Example 7: List files for the latest episode of The 100.\n    last_episode = plex.library.section('TV Shows').get('The 100').episodes()[-1]\n    for part in last_episode.iterParts():\n        print(part.file)\n\n\n.. code-block:: python\n\n    # Example 8: Get audio/video/all playlists\n    for playlist in plex.playlists():\n        print(playlist.title)\n\n\n.. code-block:: python\n\n    # Example 9: Rate the 100 four stars.\n    plex.library.section('TV Shows').get('The 100').rate(8.0)\n\n\nControlling Sonos speakers\n--------------------------\n\nTo control Sonos speakers directly using Plex APIs, the following requirements must be met:\n\n1. Active Plex Pass subscription\n2. Sonos account linked to Plex account\n3. Plex remote access enabled\n\nDue to the design of Sonos music services, the API calls to control Sonos speakers route through https://sonos.plex.tv\nand back via the Plex server's remote access. Actual media playback is local unless networking restrictions prevent the\nSonos speakers from connecting to the Plex server directly.\n\n.. code-block:: python\n\n    from plexapi.myplex import MyPlexAccount\n    from plexapi.server import PlexServer\n\n    baseurl = 'http://plexserver:32400'\n    token = '2ffLuB84dqLswk9skLos'\n\n    account = MyPlexAccount(token)\n    server = PlexServer(baseurl, token)\n\n    # List available speakers/groups\n    for speaker in account.sonos_speakers():\n        print(speaker.title)\n\n    # Obtain PlexSonosPlayer instance\n    speaker = account.sonos_speaker(\"Kitchen\")\n\n    album = server.library.section('Music').get('Stevie Wonder').album('Innervisions')\n\n    # Speaker control examples\n    speaker.playMedia(album)\n    speaker.pause()\n    speaker.setVolume(10)\n    speaker.skipNext()\n\n\nRunning tests over PlexAPI\n--------------------------\n\nUse:\n\n.. code-block:: bash\n\n     tools/plex-boostraptest.py \n    \nwith appropriate\narguments and add this new server to a shared user which username is defined in environment variable `SHARED_USERNAME`.\nIt uses `official docker image`_ to create a proper instance.\n\nFor skipping the docker and reuse a existing server use \n\n.. code-block:: bash\n\n    python plex-bootstraptest.py --no-docker --username USERNAME --password PASSWORD --server-name NAME-OF-YOUR-SEVER\n\nAlso in order to run most of the tests you have to provide some environment variables:\n\n* `PLEXAPI_AUTH_SERVER_BASEURL` containing an URL to your Plex instance, e.g. `http://127.0.0.1:32400` (without trailing\n  slash)\n* `PLEXAPI_AUTH_MYPLEX_USERNAME` and `PLEXAPI_AUTH_MYPLEX_PASSWORD` with your MyPlex username and password accordingly\n\nAfter this step you can run tests with following command:\n\n.. code-block:: bash\n\n    py.test tests -rxXs --ignore=tests/test_sync.py\n\nSome of the tests in main test-suite require a shared user in your account (e.g. `test_myplex_users`,\n`test_myplex_updateFriend`, etc.), you need to provide a valid shared user's username to get them running you need to\nprovide the username of the shared user as an environment variable `SHARED_USERNAME`. You can enable a Guest account and\nsimply pass `Guest` as `SHARED_USERNAME` (or just create a user like `plexapitest` and play with it).\n\nTo be able to run tests over Mobile Sync api you have to some some more environment variables, to following values\nexactly:\n\n* PLEXAPI_HEADER_PROVIDES='controller,sync-target'\n* PLEXAPI_HEADER_PLATFORM=iOS\n* PLEXAPI_HEADER_PLATFORM_VERSION=11.4.1\n* PLEXAPI_HEADER_DEVICE=iPhone\n\nAnd finally run the sync-related tests:\n\n.. code-block:: bash\n\n    py.test tests/test_sync.py -rxXs\n\n.. _official docker image: https://hub.docker.com/r/plexinc/pms-docker/\n\nCommon Questions\n----------------\n\n**Why are you using camelCase and not following PEP8 guidelines?**\n\nThis API reads XML documents provided by MyPlex and the Plex Server.\nWe decided to conform to their style so that the API variable names directly\nmatch with the provided XML documents.\n\n\n**Why don't you offer feature XYZ?**\n\nThis library is meant to be a wrapper around the XML pages the Plex\nserver provides. If we are not providing an API that is offered in the\nXML pages, please let us know! -- Adding additional features beyond that\nshould be done outside the scope of this library.\n\n\n**What are some helpful links if trying to understand the raw Plex API?**\n\n* https://github.com/plexinc/plex-media-player/wiki/Remote-control-API\n* https://forums.plex.tv/discussion/104353/pms-web-api-documentation\n* https://github.com/Arcanemagus/plex-api/wiki\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpushingkarmaorg%2Fpython-plexapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpushingkarmaorg%2Fpython-plexapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpushingkarmaorg%2Fpython-plexapi/lists"}