Fix #1204: insecure request warning in lyrics

This commit is contained in:
Adrian Sampson 2015-01-06 11:01:11 -08:00
parent fd2c57f736
commit daba9e770e
2 changed files with 12 additions and 2 deletions

View file

@ -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

View file

@ -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)