Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues creating PlexClient instances from PlexServer sessions in 4.15.8 #1354

Closed
jjlawren opened this issue Feb 5, 2024 · 1 comment · Fixed by #1355
Closed

Issues creating PlexClient instances from PlexServer sessions in 4.15.8 #1354

jjlawren opened this issue Feb 5, 2024 · 1 comment · Fixed by #1355

Comments

@jjlawren
Copy link
Collaborator

jjlawren commented Feb 5, 2024

Describe the Bug

An unexpected argument is passed to PlexClient when server sessions are parsed.

Code Snippets

>>> plex = PlexServer(...)
>>> plex.sessions()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jjlawren/src/plexapi/plexapi/server.py", line 817, in sessions
    return self.fetchItems('/status/sessions')
  File "/home/jjlawren/src/plexapi/plexapi/base.py", line 257, in fetchItems
    subresults = self.findItems(data, cls, ekey, **kwargs)
  File "/home/jjlawren/src/plexapi/plexapi/base.py", line 330, in findItems
    item = self._buildItemOrNone(elem, cls, initpath)
  File "/home/jjlawren/src/plexapi/plexapi/base.py", line 109, in _buildItemOrNone
    return self._buildItem(elem, cls, initpath)
  File "/home/jjlawren/src/plexapi/plexapi/base.py", line 101, in _buildItem
    return ecls(self._server, elem, initpath, parent=self)
  File "/home/jjlawren/src/plexapi/plexapi/base.py", line 62, in __init__
    self._loadData(data)
  File "/home/jjlawren/src/plexapi/plexapi/video.py", line 1188, in _loadData
    PlexSession._loadData(self, data)
  File "/home/jjlawren/src/plexapi/plexapi/base.py", line 904, in _loadData
    self.player = self.findItem(data, etag='Player')
  File "/home/jjlawren/src/plexapi/plexapi/base.py", line 341, in findItem
    return self.findItems(data, cls, initpath, rtag, **kwargs)[0]
  File "/home/jjlawren/src/plexapi/plexapi/base.py", line 330, in findItems
    item = self._buildItemOrNone(elem, cls, initpath)
  File "/home/jjlawren/src/plexapi/plexapi/base.py", line 109, in _buildItemOrNone
    return self._buildItem(elem, cls, initpath)
  File "/home/jjlawren/src/plexapi/plexapi/base.py", line 101, in _buildItem
    return ecls(self._server, elem, initpath, parent=self)
TypeError: __init__() got an unexpected keyword argument 'parent'

Expected Behavior

No response

Additional Context

This avoids the issue, but I'm unclear if this is the proper fix:

diff --git a/plexapi/client.py b/plexapi/client.py
index 279b497..a1bf292 100644
--- a/plexapi/client.py
+++ b/plexapi/client.py
@@ -62,7 +62,7 @@ class PlexClient(PlexObject):
     key = '/resources'

     def __init__(self, server=None, data=None, initpath=None, baseurl=None,
-          identifier=None, token=None, connect=True, session=None, timeout=None):
+          identifier=None, token=None, connect=True, session=None, timeout=None, parent=None):
         super(PlexClient, self).__init__(server, data, initpath)
         self._baseurl = baseurl.strip('/') if baseurl else None
         self._clientIdentifier = identifier

Operating System and Version

Linux

Plex Media Server Version

Any

Python Version

3.9

PlexAPI Version

4.15.8

@jjlawren
Copy link
Collaborator Author

jjlawren commented Feb 5, 2024

Issue introduced by #1328.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant