python-urlopen 0.1.4__tar.gz → 0.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_urlopen-0.1.4 → python_urlopen-0.1.5}/PKG-INFO +1 -1
- {python_urlopen-0.1.4 → python_urlopen-0.1.5}/pyproject.toml +1 -1
- {python_urlopen-0.1.4 → python_urlopen-0.1.5}/urlopen/__init__.py +23 -14
- {python_urlopen-0.1.4 → python_urlopen-0.1.5}/LICENSE +0 -0
- {python_urlopen-0.1.4 → python_urlopen-0.1.5}/readme.md +0 -0
- {python_urlopen-0.1.4 → python_urlopen-0.1.5}/urlopen/__main__.py +0 -0
- {python_urlopen-0.1.4 → python_urlopen-0.1.5}/urlopen/py.typed +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# coding: utf-8
|
|
3
3
|
|
|
4
4
|
__author__ = "ChenyangGao <https://chenyanggao.github.io>"
|
|
5
|
-
__version__ = (0, 1,
|
|
5
|
+
__version__ = (0, 1, 5)
|
|
6
6
|
__all__ = ["urlopen", "request", "download"]
|
|
7
7
|
|
|
8
8
|
from collections import defaultdict, deque, UserString
|
|
@@ -273,19 +273,28 @@ def urlopen(
|
|
|
273
273
|
request = url
|
|
274
274
|
else:
|
|
275
275
|
if isinstance(data, PathLike):
|
|
276
|
-
data =
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
276
|
+
data = open(data, "rb")
|
|
277
|
+
if isinstance(data, SupportsRead):
|
|
278
|
+
request_args = normalize_request_args(
|
|
279
|
+
method=method,
|
|
280
|
+
url=url,
|
|
281
|
+
params=params,
|
|
282
|
+
headers=headers,
|
|
283
|
+
ensure_ascii=True,
|
|
284
|
+
)
|
|
285
|
+
request_args["data"] = data # type: ignore
|
|
286
|
+
else:
|
|
287
|
+
request_args = normalize_request_args(
|
|
288
|
+
method=method,
|
|
289
|
+
url=url,
|
|
290
|
+
params=params,
|
|
291
|
+
data=data,
|
|
292
|
+
json=json,
|
|
293
|
+
files=files,
|
|
294
|
+
headers=headers,
|
|
295
|
+
ensure_ascii=True,
|
|
296
|
+
)
|
|
297
|
+
request = Request(**request_args) # type: ignore
|
|
289
298
|
if proxies:
|
|
290
299
|
for host, type in iter_items(proxies):
|
|
291
300
|
request.set_proxy(host, type)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|