diff --git a/Dockerfile b/Dockerfile index ba85f15..57a51d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,6 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ python3-mutagen \ python3-pil \ python3-pip \ - python3-requests \ python3-ruamel.yaml \ python3-setuptools \ sox \ diff --git a/README.md b/README.md index f7ce25a..ddf52d5 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,6 @@ Whipper relies on the following packages in order to run correctly and provide a - [musicbrainzngs](https://pypi.org/project/musicbrainzngs/), for metadata lookup - [mutagen](https://pypi.python.org/pypi/mutagen), for tagging support - [setuptools](https://pypi.python.org/pypi/setuptools), for installation, plugins support -- [requests](https://pypi.python.org/pypi/requests), for retrieving AccurateRip database entries - [pycdio](https://pypi.python.org/pypi/pycdio/), for drive identification (required for drive offset and caching behavior to be stored in the configuration file). - To avoid bugs it's advised to use the most recent `pycdio` version with the corresponding `libcdio` release or, if stuck to old pycdio versions, **0.20**/**0.21** with `libcdio` ≥ **0.90** ≤ **0.94**. All other combinations won't probably work. - [discid](https://pypi.org/project/discid/), for calculating Musicbrainz disc id. diff --git a/requirements.txt b/requirements.txt index 0f3a62e..8d7874a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,6 @@ musicbrainzngs mutagen pycdio>0.20 PyGObject -requests ruamel.yaml setuptools_scm discid \ No newline at end of file diff --git a/whipper/common/accurip.py b/whipper/common/accurip.py index ca48d5e..16c71fb 100644 --- a/whipper/common/accurip.py +++ b/whipper/common/accurip.py @@ -19,11 +19,12 @@ # You should have received a copy of the GNU General Public License # along with whipper. If not, see . -import requests import struct import whipper from os import makedirs from os.path import dirname, exists, join +from urllib.error import URLError, HTTPError +from urllib.request import urlopen, Request from whipper.common import directory from whipper.program.arc import accuraterip_checksum @@ -131,15 +132,10 @@ def _download_entry(path): UA = "whipper/%s ( https://github.com/whipper-team/whipper )" % whipper.__version__ # noqa: E501 logger.debug('downloading AccurateRip entry from %s', url) try: - resp = requests.get(url, headers={'User-Agent': UA}) - except requests.exceptions.ConnectionError as e: - logger.error('error retrieving AccurateRip entry: %r', e) - return None - if not resp.ok: - logger.error('error retrieving AccurateRip entry: %s %s %r', - resp.status_code, resp.reason, resp) - return None - return resp.content + with urlopen(Request(url, headers={'User-Agent': UA})) as resp: + return resp.read() + except (URLError, HTTPError) as e: + logger.error('error retrieving AccurateRip entry: %s', e) def _save_entry(raw_entry, path):