mirror of
https://github.com/pkkid/python-plexapi
synced 2025-02-16 12:58:26 +00:00
Add weakref to parent for PlexClient (#1355)
This commit is contained in:
parent
fb1ce365a5
commit
36cbcd0a1c
1 changed files with 4 additions and 1 deletions
|
@ -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'))
|
||||
|
|
Loading…
Add table
Reference in a new issue