From 498bdd887b2d41320f677963af81bdfff02767e8 Mon Sep 17 00:00:00 2001 From: JoeLametta Date: Wed, 29 Jan 2020 13:22:38 +0000 Subject: [PATCH] Add whipper useragent to AccurateRip requests Untested. Don't think it's required but it would be impolite not to announce the software making the requests with its name, version and contact information. Fixes #439. Signed-off-by: JoeLametta --- whipper/common/accurip.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/whipper/common/accurip.py b/whipper/common/accurip.py index 146b3d84..ca48d5eb 100644 --- a/whipper/common/accurip.py +++ b/whipper/common/accurip.py @@ -21,6 +21,7 @@ import requests import struct +import whipper from os import makedirs from os.path import dirname, exists, join @@ -127,9 +128,10 @@ def calculate_checksums(track_paths): def _download_entry(path): url = ACCURATERIP_URL + 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) + resp = requests.get(url, headers={'User-Agent': UA}) except requests.exceptions.ConnectionError as e: logger.error('error retrieving AccurateRip entry: %r', e) return None