mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-10 06:04:15 +00:00
Fix pulling server baseurl,token from config; Add option to auto connect to client from config options
This commit is contained in:
parent
0e91b64d1b
commit
08f1e4b83d
3 changed files with 7 additions and 4 deletions
|
@ -43,5 +43,5 @@ loghandler.setFormatter(logging.Formatter(logformat))
|
|||
log.addHandler(loghandler)
|
||||
log.setLevel(loglevel)
|
||||
logfilter = SecretsFilter()
|
||||
if CONFIG.get('log.secrets', '').lower() != 'true':
|
||||
if CONFIG.get('log.show_secrets', '').lower() != 'true':
|
||||
log.addFilter(logfilter)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import requests
|
||||
from requests.status_codes import _codes as codes
|
||||
from plexapi import BASE_HEADERS, TIMEOUT
|
||||
from plexapi import BASE_HEADERS, CONFIG, TIMEOUT
|
||||
from plexapi import log, logfilter, utils
|
||||
from plexapi.base import PlexObject
|
||||
from plexapi.exceptions import BadRequest, Unsupported
|
||||
|
@ -62,6 +62,9 @@ class PlexClient(PlexObject):
|
|||
self._session = session or server_session or requests.Session()
|
||||
self._proxyThroughServer = False
|
||||
self._commandId = 0
|
||||
if not any([data, initpath, baseurl, token]):
|
||||
self._baseurl = CONFIG.get('auth.client_baseurl', 'http://localhost:32433')
|
||||
self._token = logfilter.add_secret(CONFIG.get('auth.client_token'))
|
||||
if self._baseurl and self._token:
|
||||
self.connect()
|
||||
|
||||
|
|
|
@ -89,8 +89,8 @@ class PlexServer(PlexObject):
|
|||
"""
|
||||
key = '/'
|
||||
|
||||
def __init__(self, baseurl='http://localhost:32400', token=None, session=None):
|
||||
self._baseurl = baseurl or CONFIG.get('auth.server_baseurl')
|
||||
def __init__(self, baseurl=None, token=None, session=None):
|
||||
self._baseurl = baseurl or CONFIG.get('auth.server_baseurl', 'http://localhost:32400')
|
||||
self._token = logfilter.add_secret(token or CONFIG.get('auth.server_token'))
|
||||
self._session = session or requests.Session()
|
||||
self._library = None # cached library
|
||||
|
|
Loading…
Reference in a new issue