X-Git-Url: http://git.scottworley.com/pinch/blobdiff_plain/d99802b4a073c7d02c70205a144bca87723bf73a..19bbf70b0acfb4526d7b62c27b51873127104b6a:/pinch.py?ds=sidebyside diff --git a/pinch.py b/pinch.py index c101dc3..bbafe6b 100644 --- a/pinch.py +++ b/pinch.py @@ -43,6 +43,8 @@ from typing import ( import git_cache +from version import pinch_version + # Use xdg module when it's less painful to have as a dependency @@ -252,7 +254,11 @@ def compare(a: str, b: str) -> Tuple[List[str], List[str], List[str]]: def fetch_channel( v: Verification, channel: ChannelSearchPath) -> Tuple[str, str]: v.status(f'Fetching channel from {channel.channel_url}') - with urllib.request.urlopen(channel.channel_url, timeout=10) as request: + with urllib.request.urlopen( + urllib.request.Request( + url=channel.channel_url, + headers={'User-Agent': f'pinch-{pinch_version}'}), + timeout=10) as request: channel_html = request.read().decode() forwarded_url = request.geturl() v.result(request.status == 200)