Skip to content

Commit 68e59fe

Browse files
committed
Remove Python2 compatibility check
1 parent 7f9ed16 commit 68e59fe

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

pandas/io/common.py

+2-9
Original file line numberDiff line numberDiff line change
@@ -148,16 +148,9 @@ def urlopen(*args, **kwargs):
148148
Lazy-import wrapper for stdlib urlopen, as that imports a big chunk of
149149
the stdlib.
150150
"""
151-
import urllib.request
151+
from urllib.request import Request, urlopen as _urlopen
152152

153-
# Request class is only available in Python3, which
154-
# allows headers to be specified
155-
if hasattr(urllib.request, "Request"):
156-
r = urllib.request.urlopen(urllib.request.Request(*args, **kwargs))
157-
else:
158-
r = urllib.request.urlopen(*args, **kwargs)
159-
160-
return r
153+
return _urlopen(Request(*args, **kwargs))
161154

162155

163156
def is_fsspec_url(url: FilePathOrBuffer) -> bool:

0 commit comments

Comments
 (0)