diff options
author | morpheus65535 <[email protected]> | 2023-08-06 16:47:11 -0400 |
---|---|---|
committer | morpheus65535 <[email protected]> | 2023-08-06 16:47:11 -0400 |
commit | 7e211f62500019877838e21ead2c5442b501d731 (patch) | |
tree | 15b1d0327e4247f75baeaab8fbbf9b1140741363 /libs | |
parent | d284e629b7163bab1a4f9fb8f698fe82006c88db (diff) | |
download | bazarr-7e211f62500019877838e21ead2c5442b501d731.tar.gz bazarr-7e211f62500019877838e21ead2c5442b501d731.zip |
Removed sensitive information from opensubtitles.com debug logging.
Diffstat (limited to 'libs')
-rw-r--r-- | libs/subliminal_patch/providers/opensubtitlescom.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libs/subliminal_patch/providers/opensubtitlescom.py b/libs/subliminal_patch/providers/opensubtitlescom.py index 6a21ddf5f..c7eb2d8d9 100644 --- a/libs/subliminal_patch/providers/opensubtitlescom.py +++ b/libs/subliminal_patch/providers/opensubtitlescom.py @@ -3,6 +3,7 @@ import logging import os import time import datetime +import json from requests import Session, ConnectionError, Timeout, ReadTimeout, RequestException from requests.exceptions import JSONDecodeError @@ -540,10 +541,18 @@ class OpenSubtitlesComProvider(ProviderRetryMixin, Provider): def log_request_response(response): + redacted_request_headers = response.request.headers + if 'Authorization' in redacted_request_headers: + redacted_request_headers['Authorization'] = 'redacted' + + redacted_request_body = json.loads(response.request.body) + if 'password' in redacted_request_body: + redacted_request_body['password'] = 'redacted' + logging.debug("opensubtitlescom returned a non standard response. Logging request/response for debugging purpose.") logging.debug(f"Request URL: {response.request.url}") - logging.debug(f"Request Headers: {response.request.headers}") - logging.debug(f"Request Body: {response.request.body}") + logging.debug(f"Request Headers: {redacted_request_headers}") + logging.debug(f"Request Body: {json.dumps(redacted_request_body)}") logging.debug(f"Response Status Code: {response.status_code}") logging.debug(f"Response Headers: {response.headers}") logging.debug(f"Response Body: {response.text}") |