Skip to content

Commit

Permalink
Add weakref to parent for PlexClient (#1355)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyWong16 committed Feb 5, 2024
1 parent fb1ce36 commit 36cbcd0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plexapi/client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
import time
import weakref
from xml.etree import ElementTree

import requests
Expand Down Expand Up @@ -62,7 +63,8 @@ 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
Expand All @@ -76,6 +78,7 @@ def __init__(self, server=None, data=None, initpath=None, baseurl=None,
self._last_call = 0
self._timeline_cache = []
self._timeline_cache_timestamp = 0
self._parent = weakref.ref(parent) if parent is not None else None
if not any([data is not None, initpath, baseurl, token]):
self._baseurl = CONFIG.get('auth.client_baseurl', 'http://localhost:32433')
self._token = logfilter.add_secret(CONFIG.get('auth.client_token'))
Expand Down

0 comments on commit 36cbcd0

Please sign in to comment.