From e244227f41708084925d026ceb341953688ae31f Mon Sep 17 00:00:00 2001 From: Martin Zimmermann Date: Thu, 19 Dec 2013 08:09:09 +0100 Subject: [PATCH] convert proxy object to string before passing to urllib --- isso/utils/parse.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/isso/utils/parse.py b/isso/utils/parse.py index 7ed2711..b6e39b0 100644 --- a/isso/utils/parse.py +++ b/isso/utils/parse.py @@ -14,7 +14,7 @@ except ImportError: import html5lib -from isso.compat import map, filter, PY2K +from isso.compat import map, filter, PY2K, string_types, text_type as str if PY2K: # http://bugs.python.org/issue12984 from xml.dom.minidom import NamedNodeMap @@ -67,6 +67,9 @@ def host(name): ('example.tld', 80, True) """ + if not (isinstance(name, string_types)): + name = str(name) + if not name.startswith(('http://', 'https://')): name = 'http://' + name