diff --git a/resources/lib/youtube_plugin/kodion/plugin_runner.py b/resources/lib/youtube_plugin/kodion/plugin_runner.py index 66e361603..e5fa69fcf 100644 --- a/resources/lib/youtube_plugin/kodion/plugin_runner.py +++ b/resources/lib/youtube_plugin/kodion/plugin_runner.py @@ -10,7 +10,6 @@ from __future__ import absolute_import, division, unicode_literals -from copy import deepcopy from platform import python_version from .context import XbmcContext @@ -44,7 +43,7 @@ def run(context=_context, context.init() new_uri = context.get_uri() - params = deepcopy(context.get_params()) + params = context.get_params().copy() for key in ('api_key', 'client_id', 'client_secret'): if key in params: params[key] = '' diff --git a/resources/lib/youtube_plugin/kodion/utils/methods.py b/resources/lib/youtube_plugin/kodion/utils/methods.py index e0337b16a..2d14a0108 100644 --- a/resources/lib/youtube_plugin/kodion/utils/methods.py +++ b/resources/lib/youtube_plugin/kodion/utils/methods.py @@ -10,7 +10,6 @@ from __future__ import absolute_import, division, unicode_literals -import copy import json import os import re @@ -97,13 +96,15 @@ def _stream_sort(_stream): context.log_debug('Available streams: {0}'.format(num_streams)) for idx, stream in enumerate(stream_list): - log_data = copy.deepcopy(stream) + log_data = stream.copy() if 'license_info' in log_data: + license_info = log_data['license_info'].copy() for detail in ('url', 'token'): - original_value = log_data['license_info'].get(detail) + original_value = license_info.get(detail) if original_value: - log_data['license_info'][detail] = '' + license_info[detail] = '' + log_data['license_info'] = license_info original_value = log_data.get('url') if original_value: diff --git a/resources/lib/youtube_plugin/youtube/client/request_client.py b/resources/lib/youtube_plugin/youtube/client/request_client.py index bf1fb5159..506241b8b 100644 --- a/resources/lib/youtube_plugin/youtube/client/request_client.py +++ b/resources/lib/youtube_plugin/youtube/client/request_client.py @@ -356,12 +356,20 @@ def build_client(cls, client_name=None, data=None): params = client['params'] if client.get('_access_token'): if 'key' in params: + params = params.copy() del params['key'] + client['params'] = params else: - if 'Authorization' in client['headers']: - del client['headers']['Authorization'] + headers = client['headers'] + if 'Authorization' in headers: + headers = headers.copy() + del headers['Authorization'] + client['headers'] = headers + if 'key' in params and params['key'] is ValueError: + params = params.copy() del params['key'] + client['params'] = params except KeyError: pass diff --git a/resources/lib/youtube_plugin/youtube/client/youtube.py b/resources/lib/youtube_plugin/youtube/client/youtube.py index 8295d2a16..1cc3dd2c0 100644 --- a/resources/lib/youtube_plugin/youtube/client/youtube.py +++ b/resources/lib/youtube_plugin/youtube/client/youtube.py @@ -12,7 +12,6 @@ import threading import xml.etree.ElementTree as ET -from copy import deepcopy from functools import partial from itertools import chain, islice from random import randint @@ -2022,19 +2021,21 @@ def api_request(self, client = self.build_client(version, client_data) - if 'key' in client['params'] and not client['params']['key']: + params = client.get('params') + if 'key' in params and not params['key']: + params = params.copy() key = self._config.get('key') or self._config_tv.get('key') if key: - client['params']['key'] = key + params['key'] = key else: - del client['params']['key'] + del params['key'] + client['params'] = params if clear_data and 'json' in client: del client['json'] - params = client.get('params') if params: - log_params = deepcopy(params) + log_params = params.copy() if 'location' in log_params: log_params['location'] = '|xx.xxxx,xx.xxxx|' if 'key' in log_params: @@ -2045,7 +2046,7 @@ def api_request(self, headers = client.get('headers') if headers: - log_headers = deepcopy(headers) + log_headers = headers.copy() if 'Authorization' in log_headers: log_headers['Authorization'] = '|logged in|' else: diff --git a/resources/lib/youtube_plugin/youtube/helper/yt_login.py b/resources/lib/youtube_plugin/youtube/helper/yt_login.py index 15dffb72a..d951d869d 100644 --- a/resources/lib/youtube_plugin/youtube/helper/yt_login.py +++ b/resources/lib/youtube_plugin/youtube/helper/yt_login.py @@ -10,7 +10,6 @@ from __future__ import absolute_import, division, unicode_literals -import copy import time from ..youtube_exceptions import LoginException @@ -81,7 +80,7 @@ def _do_login(login_type): _do_logout() raise - log_data = copy.deepcopy(json_data) + log_data = json_data.copy() if 'access_token' in log_data: log_data['access_token'] = '' if 'refresh_token' in log_data: