[calm - Cygwin server-side packaging maintenance script] branch master, updated. 20200401-9-g49c58c4
Jon TURNEY via Cygwin-apps-cvs <[email protected]>
| Newsgroups | gmane.os.cygwin.cvs.apps |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=49c58c4aeb14b75be801856024d64713e645ddc3 commit 49c58c4aeb14b75be801856024d64713e645ddc3 Author: Jon Turney <[email protected]> Date: Mon Apr 13 16:46:27 2020 +0100 Add a tool for demonstrating version sort https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=2d6362640447e1766a0c2dccb2bdc12ed6037c92 commit 2d6362640447e1766a0c2dccb2bdc12ed6037c92 Author: Jon Turney <[email protected]> Date: Mon Apr 13 15:51:36 2020 +0100 Enhance homepage fixing Handle: * Trivial terminal '/' redirects * 308 Permanent Redirect as well as 301 Moved Permanently * sites which block urllib's default user-agent Diff: --- calm/fixes.py | 1 + 1 file changed, 1 insertion(+) diff --git a/calm/fixes.py b/calm/fixes.py index b42c575..a89896a 100644 --- a/calm/fixes.py +++ b/calm/fixes.py @@ -71,6 +71,7 @@ class NoRedirection(urllib.request.HTTPErrorProcessor): @functools.lru_cache(maxsize=None) def follow_redirect(homepage): opener = urllib.request.build_opener(NoRedirection) + opener.addheaders = [('User-Agent', 'calm')] try: response = opener.open(homepage) if response.code in [301, 308]: