public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
* [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20200401-9-g49c58c4
@ 2020-04-13 18:06 Jon TURNEY
0 siblings, 0 replies; only message in thread
From: Jon TURNEY @ 2020-04-13 18:06 UTC (permalink / raw)
To: cygwin-apps-cvs
https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=49c58c4aeb14b75be801856024d64713e645ddc3
commit 49c58c4aeb14b75be801856024d64713e645ddc3
Author: Jon Turney <jon.turney@dronecode.org.uk>
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 <jon.turney@dronecode.org.uk>
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]:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-04-13 18:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-13 18:06 [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20200401-9-g49c58c4 Jon TURNEY
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).