python-urlopen 0.0.5.2__tar.gz → 0.0.6__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.0.5.2 → python_urlopen-0.0.6}/PKG-INFO +1 -1
- {python_urlopen-0.0.5.2 → python_urlopen-0.0.6}/pyproject.toml +1 -1
- {python_urlopen-0.0.5.2 → python_urlopen-0.0.6}/urlopen/__init__.py +5 -5
- {python_urlopen-0.0.5.2 → python_urlopen-0.0.6}/LICENSE +0 -0
- {python_urlopen-0.0.5.2 → python_urlopen-0.0.6}/readme.md +0 -0
- {python_urlopen-0.0.5.2 → python_urlopen-0.0.6}/urlopen/__main__.py +0 -0
- {python_urlopen-0.0.5.2 → python_urlopen-0.0.6}/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, 0,
|
|
5
|
+
__version__ = (0, 0, 6)
|
|
6
6
|
__all__ = ["urlopen", "request", "download"]
|
|
7
7
|
|
|
8
8
|
import errno
|
|
@@ -27,7 +27,7 @@ from zlib import compressobj, DEF_MEM_LEVEL, DEFLATED, MAX_WBITS
|
|
|
27
27
|
|
|
28
28
|
from argtools import argcount
|
|
29
29
|
from brotli import decompress as decompress_br # type: ignore
|
|
30
|
-
from filewrap import bio_skip_iter,
|
|
30
|
+
from filewrap import bio_skip_iter, SupportsWrite
|
|
31
31
|
from http_response import get_filename, get_length, is_chunked, is_range_request
|
|
32
32
|
from zstandard import decompress as decompress_zstd
|
|
33
33
|
|
|
@@ -87,8 +87,8 @@ def urlopen(
|
|
|
87
87
|
timeout: None | int | float = None,
|
|
88
88
|
cookies: None | CookieJar = None,
|
|
89
89
|
proxy: None | tuple[str, str] = None,
|
|
90
|
-
opener: None | OpenerDirector = None,
|
|
91
90
|
context: None | SSLContext = None,
|
|
91
|
+
opener: OpenerDirector = build_opener(HTTPSHandler(context=_create_unverified_context())),
|
|
92
92
|
origin: None | str = None,
|
|
93
93
|
) -> HTTPResponse:
|
|
94
94
|
if isinstance(url, str) and not urlsplit(url).scheme:
|
|
@@ -137,8 +137,8 @@ def urlopen(
|
|
|
137
137
|
req = Request(url, data=data, headers=headers or {}, method=method.upper())
|
|
138
138
|
if proxy:
|
|
139
139
|
req.set_proxy(*proxy)
|
|
140
|
-
if
|
|
141
|
-
opener =
|
|
140
|
+
if context is not None or cookies is not None:
|
|
141
|
+
opener = copy(opener)
|
|
142
142
|
if context is not None:
|
|
143
143
|
opener.add_handler(HTTPSHandler(context=context))
|
|
144
144
|
if cookies is not None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|