Skip to content

Commit

Permalink
Add whipper useragent to AccurateRip requests
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
JoeLametta committed Jan 29, 2020
1 parent dea7db1 commit 498bdd8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion whipper/common/accurip.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import requests
import struct
import whipper
from os import makedirs
from os.path import dirname, exists, join

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 498bdd8

Please sign in to comment.