Support for issuing callbacks in response to Plex websocket updates.
Project description
python-plexwebsocket
Async library to react to events issued over Plex websockets.
Example use
import asyncio
import logging
from plexapi.server import PlexServer
from plexwebsocket import PlexWebsocket, SIGNAL_CONNECTION_STATE
logging.basicConfig(level=logging.DEBUG)
baseurl = 'http://<PLEX_SERVER_IP>:32400'
token = '<YOUR_TOKEN_HERE>'
plex = PlexServer(baseurl, token)
def print_info(msgtype, data, error):
if msgtype == SIGNAL_CONNECTION_STATE:
print(f"State: {data} / Error: {error}")
else:
print(f"Data: {data}")
async def main():
ws = PlexWebsocket(plex, print_info, subscriptions=["playing", "status"])
await ws.listen()
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
plexwebsocket-0.0.14.tar.gz
(4.0 kB
view details)
Built Distribution
File details
Details for the file plexwebsocket-0.0.14.tar.gz
.
File metadata
- Download URL: plexwebsocket-0.0.14.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f90c50c05e0cf2d824b9e3083ad77d843d8ef9d4e80c01ed34181c2ef094f80b |
|
MD5 | 39cf1fdb01c273611b94c93cc1d93d55 |
|
BLAKE2b-256 | dd53e37efeb5e29bc2c3036cb4b06257fd2b4699a88a7269cc2233337b93e5c9 |
File details
Details for the file plexwebsocket-0.0.14-py3-none-any.whl
.
File metadata
- Download URL: plexwebsocket-0.0.14-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f00aa36a42908ca16a8c5a79ddbb99e9b9d98538636a41eb2666edcb85b6141c |
|
MD5 | 6e457dec2cfe8b9263f1140b7edc66d6 |
|
BLAKE2b-256 | 3d87b52611c5009f5b3d1025eec28dbcf04a5a8ddac2883a935a535986bbff09 |