From daba9e770e5b1b17161c2743aa35ac0e97b1fbf9 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Tue, 6 Jan 2015 11:01:11 -0800 Subject: [PATCH] Fix #1204: insecure request warning in lyrics --- beetsplug/lyrics.py | 9 ++++++++- docs/changelog.rst | 5 ++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/beetsplug/lyrics.py b/beetsplug/lyrics.py index a87715fe3..bffa8414c 100644 --- a/beetsplug/lyrics.py +++ b/beetsplug/lyrics.py @@ -23,6 +23,7 @@ import unicodedata import urllib import difflib import itertools +import warnings from HTMLParser import HTMLParseError from beets import logging @@ -61,7 +62,13 @@ def fetch_url(url): is unreachable. """ try: - r = requests.get(url, verify=False) + # Disable the InsecureRequestWarning that comes from using + # `verify=false`. + # https://github.com/kennethreitz/requests/issues/2214 + # We're not overly worried about the NSA MITMing our lyrics scraper. + with warnings.catch_warnings(): + warnings.simplefilter('ignore') + r = requests.get(url, verify=False) except requests.RequestException as exc: log.debug(u'lyrics request failed: {0}', exc) return diff --git a/docs/changelog.rst b/docs/changelog.rst index 5936d1237..e77bf480f 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -4,7 +4,10 @@ Changelog 1.3.11 (in development) ----------------------- -Changelog goes here! +Fixes: + +* :doc:`/plugins/lyrics`: Silence a warning about insecure requests in the new + MusixMatch backend. :bug:`1204` 1.3.10 (January 5, 2015)