Skip to content

Commit 36cbcd0

Browse files
authored
Add weakref to parent for PlexClient (#1355)
1 parent fb1ce36 commit 36cbcd0

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

plexapi/client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# -*- coding: utf-8 -*-
22
import time
3+
import weakref
34
from xml.etree import ElementTree
45

56
import requests
@@ -62,7 +63,8 @@ class PlexClient(PlexObject):
6263
key = '/resources'
6364

6465
def __init__(self, server=None, data=None, initpath=None, baseurl=None,
65-
identifier=None, token=None, connect=True, session=None, timeout=None):
66+
identifier=None, token=None, connect=True, session=None, timeout=None,
67+
parent=None):
6668
super(PlexClient, self).__init__(server, data, initpath)
6769
self._baseurl = baseurl.strip('/') if baseurl else None
6870
self._clientIdentifier = identifier
@@ -76,6 +78,7 @@ def __init__(self, server=None, data=None, initpath=None, baseurl=None,
7678
self._last_call = 0
7779
self._timeline_cache = []
7880
self._timeline_cache_timestamp = 0
81+
self._parent = weakref.ref(parent) if parent is not None else None
7982
if not any([data is not None, initpath, baseurl, token]):
8083
self._baseurl = CONFIG.get('auth.client_baseurl', 'http://localhost:32433')
8184
self._token = logfilter.add_secret(CONFIG.get('auth.client_token'))

0 commit comments

Comments
 (0)