From 4fd8b89f494dffcdc1f2351a3cd64ee57ce29114 Mon Sep 17 00:00:00 2001 From: Lionel Dricot Date: Tue, 18 Jul 2023 00:45:14 +0200 Subject: [PATCH] monkey patching --- netcache.py | 7 +++++++ offpunk.py | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/netcache.py b/netcache.py index b9c1847..115ca4f 100755 --- a/netcache.py +++ b/netcache.py @@ -41,6 +41,13 @@ CRLF = '\r\n' DEFAULT_TIMEOUT = 10 _MAX_REDIRECTS = 5 +# monkey-patch Gemini support in urllib.parse +# see https://github.com/python/cpython/blob/master/Lib/urllib/parse.py +urllib.parse.uses_relative.append("gemini") +urllib.parse.uses_netloc.append("gemini") +urllib.parse.uses_relative.append("spartan") +urllib.parse.uses_netloc.append("spartan") + def parse_mime(mime): options = {} if mime: diff --git a/offpunk.py b/offpunk.py index 54d3572..b615524 100755 --- a/offpunk.py +++ b/offpunk.py @@ -131,13 +131,6 @@ _ABBREVS = { _MIME_HANDLERS = { } -# monkey-patch Gemini support in urllib.parse -# see https://github.com/python/cpython/blob/master/Lib/urllib/parse.py -urllib.parse.uses_relative.append("gemini") -urllib.parse.uses_netloc.append("gemini") -urllib.parse.uses_relative.append("spartan") -urllib.parse.uses_netloc.append("spartan") - #An IPV6 URL should be put between [] #We try to detect them has location with more than 2 ":" def fix_ipv6_url(url):