python-urlopen 0.0.5.1__tar.gz → 0.0.5.2__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.1 → python_urlopen-0.0.5.2}/PKG-INFO +1 -1
- {python_urlopen-0.0.5.1 → python_urlopen-0.0.5.2}/pyproject.toml +1 -1
- {python_urlopen-0.0.5.1 → python_urlopen-0.0.5.2}/urlopen/__init__.py +5 -3
- {python_urlopen-0.0.5.1 → python_urlopen-0.0.5.2}/LICENSE +0 -0
- {python_urlopen-0.0.5.1 → python_urlopen-0.0.5.2}/readme.md +0 -0
- {python_urlopen-0.0.5.1 → python_urlopen-0.0.5.2}/urlopen/__main__.py +0 -0
- {python_urlopen-0.0.5.1 → python_urlopen-0.0.5.2}/urlopen/py.typed +0 -0
|
@@ -34,6 +34,8 @@ from zstandard import decompress as decompress_zstd
|
|
|
34
34
|
|
|
35
35
|
if "__del__" not in HTTPResponse.__dict__:
|
|
36
36
|
setattr(HTTPResponse, "__del__", HTTPResponse.close)
|
|
37
|
+
if "__del__" not in OpenerDirector.__dict__:
|
|
38
|
+
setattr(OpenerDirector, "__del__", OpenerDirector.close)
|
|
37
39
|
|
|
38
40
|
CRE_search_charset = re_compile(r"\bcharset=(?P<charset>[^ ;]+)").search
|
|
39
41
|
|
|
@@ -85,7 +87,7 @@ def urlopen(
|
|
|
85
87
|
timeout: None | int | float = None,
|
|
86
88
|
cookies: None | CookieJar = None,
|
|
87
89
|
proxy: None | tuple[str, str] = None,
|
|
88
|
-
opener: OpenerDirector =
|
|
90
|
+
opener: None | OpenerDirector = None,
|
|
89
91
|
context: None | SSLContext = None,
|
|
90
92
|
origin: None | str = None,
|
|
91
93
|
) -> HTTPResponse:
|
|
@@ -136,7 +138,7 @@ def urlopen(
|
|
|
136
138
|
if proxy:
|
|
137
139
|
req.set_proxy(*proxy)
|
|
138
140
|
if opener is None:
|
|
139
|
-
opener = build_opener()
|
|
141
|
+
opener = build_opener(HTTPSHandler(context=_create_unverified_context()))
|
|
140
142
|
if context is not None:
|
|
141
143
|
opener.add_handler(HTTPSHandler(context=context))
|
|
142
144
|
if cookies is not None:
|
|
@@ -179,7 +181,7 @@ def request(
|
|
|
179
181
|
with resp:
|
|
180
182
|
if isinstance(parse, bool):
|
|
181
183
|
data = decompress_response(resp)
|
|
182
|
-
if parse
|
|
184
|
+
if parse:
|
|
183
185
|
content_type = resp.headers.get("Content-Type", "")
|
|
184
186
|
if content_type == "application/json":
|
|
185
187
|
return loads(data)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|