Add weakref to parent for PlexClient (#1355)

This commit is contained in:
JonnyWong16 2024-02-04 20:34:16 -08:00 committed by GitHub
parent fb1ce365a5
commit 36cbcd0a1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
import time
import weakref
from xml.etree import ElementTree
import requests
@ -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
@ -76,6 +78,7 @@ class PlexClient(PlexObject):
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'))