From 74c93980afe39fee3b30b5591c2908cd6f4848a2 Mon Sep 17 00:00:00 2001 From: Hannah Mendez Date: Mon, 18 Jun 2018 11:58:54 -0700 Subject: [PATCH 1/2] fixed unicode issue (21499) using requests library --- pandas/io/html.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/io/html.py b/pandas/io/html.py index 8fd876e85889f..e9fc5325094f2 100644 --- a/pandas/io/html.py +++ b/pandas/io/html.py @@ -127,8 +127,8 @@ def _read(obj): raw_text : str """ if _is_url(obj): - with urlopen(obj) as url: - text = url.read() + import requests + text = requests.get(obj).content elif hasattr(obj, 'read'): text = obj.read() elif isinstance(obj, char_types): @@ -984,4 +984,4 @@ def read_html(io, match='.+', flavor=None, header=None, index_col=None, thousands=thousands, attrs=attrs, encoding=encoding, decimal=decimal, converters=converters, na_values=na_values, keep_default_na=keep_default_na, - displayed_only=displayed_only) + displayed_only=displayed_only) \ No newline at end of file From 670b1f007292f011f08b71a40d6a3670507fb4d2 Mon Sep 17 00:00:00 2001 From: Hannah Mendez Date: Mon, 18 Jun 2018 12:04:34 -0700 Subject: [PATCH 2/2] Update html.py --- pandas/io/html.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/io/html.py b/pandas/io/html.py index e9fc5325094f2..3b43a136c5424 100644 --- a/pandas/io/html.py +++ b/pandas/io/html.py @@ -984,4 +984,5 @@ def read_html(io, match='.+', flavor=None, header=None, index_col=None, thousands=thousands, attrs=attrs, encoding=encoding, decimal=decimal, converters=converters, na_values=na_values, keep_default_na=keep_default_na, - displayed_only=displayed_only) \ No newline at end of file + displayed_only=displayed_only) +