Drop 'requests' external dependency

It was only used in a single method and wasn't really needed.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
This commit is contained in:
JoeLametta
2020-02-03 15:55:41 +00:00
parent 8428b69448
commit 87e75d0f98
4 changed files with 6 additions and 13 deletions

View File

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

View File

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

View File

@@ -2,7 +2,6 @@ musicbrainzngs
mutagen
pycdio>0.20
PyGObject
requests
ruamel.yaml
setuptools_scm
discid

View File

@@ -19,11 +19,12 @@
# You should have received a copy of the GNU General Public License
# along with whipper. If not, see <http://www.gnu.org/licenses/>.
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):