From a1af5d280e56d51f2970997339582eae0305758b Mon Sep 17 00:00:00 2001 From: Tyler Faulk Date: Tue, 10 Dec 2019 22:54:31 -0500 Subject: [PATCH 1/2] added merge_environment_settings call in fetchart plugin to handle connections with proxy servers --- beetsplug/fetchart.py | 6 +++++- docs/changelog.rst | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/beetsplug/fetchart.py b/beetsplug/fetchart.py index a815d4d9b..ca93d685e 100644 --- a/beetsplug/fetchart.py +++ b/beetsplug/fetchart.py @@ -164,13 +164,17 @@ def _logged_get(log, *args, **kwargs): message = 'getting URL' req = requests.Request('GET', *args, **req_kwargs) + with requests.Session() as s: s.headers = {'User-Agent': 'beets'} prepped = s.prepare_request(req) + settings = s.merge_environment_settings( + prepped.url, {}, None, None, None + ) + send_kwargs.update(settings) log.debug('{}: {}', message, prepped.url) return s.send(prepped, **send_kwargs) - class RequestMixin(object): """Adds a Requests wrapper to the class that uses the logger, which must be named `self._log`. diff --git a/docs/changelog.rst b/docs/changelog.rst index b5b6c3901..e24bb976e 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -99,6 +99,9 @@ New features: Fixes: +* :doc:`/plugins/fetchart`: Fixed a bug that caused fetchart to not take + environment variables such as proxy servers into account when making requests + :bug:`3450` * :doc:`/plugins/inline`: In function-style field definitions that refer to flexible attributes, values could stick around from one function invocation to the next. This meant that, when displaying a list of objects, later From 964a6c2e63e56a9d04f1c34cc8b21511e0a11ba0 Mon Sep 17 00:00:00 2001 From: Tyler Faulk Date: Thu, 6 Feb 2020 12:10:38 -0500 Subject: [PATCH 2/2] restored whitespace to please style checker --- beetsplug/fetchart.py | 1 + 1 file changed, 1 insertion(+) diff --git a/beetsplug/fetchart.py b/beetsplug/fetchart.py index ca93d685e..f78e6116a 100644 --- a/beetsplug/fetchart.py +++ b/beetsplug/fetchart.py @@ -175,6 +175,7 @@ def _logged_get(log, *args, **kwargs): log.debug('{}: {}', message, prepped.url) return s.send(prepped, **send_kwargs) + class RequestMixin(object): """Adds a Requests wrapper to the class that uses the logger, which must be named `self._log`.