Change factory.session to property
MODIFY
plextraktsync/commands/cache.py
plextraktsync/commands/cache.py
@@ -74,7 +74,7 @@ def cache_status(cache):
def cache(sort: str, limit: int, reverse: bool, url: str):
- session = factory.session()
+ session = factory.session
if url:
inspect_url(session, url)

MODIFY
plextraktsync/decorators/http_cache.py
plextraktsync/decorators/http_cache.py
from plextraktsync.factory import factory
-session = factory.session()
+session = factory.session
def http_cache(method, expire_after=None):

MODIFY
plextraktsync/decorators/nocache.py
plextraktsync/decorators/nocache.py
from plextraktsync.factory import factory
-session = factory.session()
+session = factory.session
def nocache(method):

MODIFY
plextraktsync/factory.py
plextraktsync/factory.py
@@ -58,7 +58,7 @@ def server_config(self):
return server_config.get_server(server_name)
- @memoize
+ @cached_property
def session(self):
from requests_cache import CachedSession

MODIFY
plextraktsync/plex_server.py
plextraktsync/plex_server.py
@@ -25,7 +25,7 @@ def config(self):
@property
def session(self):
- return self.factory.session()
+ return self.factory.session
@nocache
def connect(self, urls: List[str], token: str):

MODIFY
plextraktsync/trakt_api.py
plextraktsync/trakt_api.py
@@ -92,7 +92,7 @@ class TraktApi:
def __init__(self, batch_delay=None):
self.batch_delay = batch_delay
trakt.core.CONFIG_PATH = pytrakt_file
- trakt.core.session = factory.session()
+ trakt.core.session = factory.session
@staticmethod
def device_auth(client_id: str, client_secret: str):

Change factory.session to property