Skip to content

Commit a7e87a5

Browse files
authored
Expose callbackError parameter in PlexServer.startAlertListener() (#985)
* Expose callbackError This makes it easier to catch errors without separately instantiating an AlertListener * Update docstring. * Fix docstring Removed post-argument note, incorporated suggestion.
1 parent 3a56c69 commit a7e87a5

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

plexapi/server.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -753,21 +753,27 @@ def transcodeSessions(self):
753753
""" Returns a list of all active :class:`~plexapi.media.TranscodeSession` objects. """
754754
return self.fetchItems('/transcode/sessions')
755755

756-
def startAlertListener(self, callback=None):
756+
def startAlertListener(self, callback=None, callbackError=None):
757757
""" Creates a websocket connection to the Plex Server to optionally receive
758758
notifications. These often include messages from Plex about media scans
759759
as well as updates to currently running Transcode Sessions.
760760
761-
NOTE: You need websocket-client installed in order to use this feature.
762-
>> pip install websocket-client
761+
Returns a new :class:`~plexapi.alert.AlertListener` object.
762+
763+
Note: ``websocket-client`` must be installed in order to use this feature.
764+
765+
.. code-block:: python
766+
767+
>> pip install websocket-client
763768
764769
Parameters:
765770
callback (func): Callback function to call on received messages.
771+
callbackError (func): Callback function to call on errors.
766772
767773
Raises:
768774
:exc:`~plexapi.exception.Unsupported`: Websocket-client not installed.
769775
"""
770-
notifier = AlertListener(self, callback)
776+
notifier = AlertListener(self, callback, callbackError)
771777
notifier.start()
772778
return notifier
773779

0 commit comments

Comments
 (0)