[issue17214] http.client.HTTPConnection.putrequest encode error
Vajrasky Kok
report at bugs.python.org
Thu Jul 18 12:29:06 CEST 2013
Vajrasky Kok added the comment:
The script for demonstrating bug can be simplified to:
-----------------------------------------------------------------------
import urllib.request
url = "http://www.libon.it/ricerca/7817940/3499155443/dettaglio/3102314/Onkel-Oswald-und-der-Sudan-Käfer/order/date_desc"
req = urllib.request.Request(url)
response = urllib.request.urlopen(req, timeout=30)
the_page = response.read().decode('utf-8')
print(the_page)
-----------------------------------------------------------------------
Attached the simple patch to solve this problem.
The question is whether we should fix this problem in urllib or not because strictly speaking the url should be ascii characters only. But if the Firefox can open this url, why not urllib?
I will contemplate about this problem and if I (or other people) think that urllib should handle url containing non-ascii characters, then I will add additional unit test.
Until then, people can use third party package, which is
request package from http://docs.python-requests.org/en/latest/
----------------------------------------------------------------
r = requests.get("http://www.libon.it/ricerca/7817940/3499155443/dettaglio/3102314/Onkel-Oswald-und-der-Sudan-Käfer/order/date_desc")
print(r.text)
----------------------------------------------------------------
----------
nosy: +vajrasky
Added file: http://bugs.python.org/file30964/patch_to_urllib_handle_non_ascii_char_in_url.txt
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17214>
_______________________________________
More information about the Python-bugs-list
mailing list