We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7f9ed16 commit 68e59feCopy full SHA for 68e59fe
pandas/io/common.py
@@ -148,16 +148,9 @@ def urlopen(*args, **kwargs):
148
Lazy-import wrapper for stdlib urlopen, as that imports a big chunk of
149
the stdlib.
150
"""
151
- import urllib.request
+ from urllib.request import Request, urlopen as _urlopen
152
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
+ return _urlopen(Request(*args, **kwargs))
161
162
163
def is_fsspec_url(url: FilePathOrBuffer) -> bool:
0 commit comments