Skip to content

fixed unicode issue (21499) using requests library #21532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pandas/io/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ def _read(obj):
raw_text : str
"""
if _is_url(obj):
with urlopen(obj) as url:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WillAyd in my PR all urlopen calls are wrap with requests if it is available so I guess we cover this one in #21504

text = url.read()
import requests
text = requests.get(obj).content
elif hasattr(obj, 'read'):
text = obj.read()
elif isinstance(obj, char_types):
Expand Down Expand Up @@ -985,3 +985,4 @@ def read_html(io, match='.+', flavor=None, header=None, index_col=None,
decimal=decimal, converters=converters, na_values=na_values,
keep_default_na=keep_default_na,
displayed_only=displayed_only)