Couple of trivialities

This commit is contained in:
Miroslav Stampar
2020-05-15 12:58:03 +02:00
parent 9077734ec5
commit a851dc486a
4 changed files with 9 additions and 7 deletions

View File

@@ -154,6 +154,7 @@ class SmartRedirectHandler(_urllib.request.HTTPRedirectHandler):
except AttributeError:
def _(self):
return getattr(self, "hdrs") or {}
result.info = types.MethodType(_, result)
if not hasattr(result, "read"):
@@ -164,6 +165,7 @@ class SmartRedirectHandler(_urllib.request.HTTPRedirectHandler):
retVal = ""
finally:
return retVal
result.read = types.MethodType(_, result)
if not getattr(result, "url", None):