python-urlopen 0.1.6.1__tar.gz → 0.1.6.3__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.6.1 → python_urlopen-0.1.6.3}/PKG-INFO +2 -2
- {python_urlopen-0.1.6.1 → python_urlopen-0.1.6.3}/pyproject.toml +2 -2
- {python_urlopen-0.1.6.1 → python_urlopen-0.1.6.3}/urlopen/__init__.py +14 -16
- {python_urlopen-0.1.6.1 → python_urlopen-0.1.6.3}/LICENSE +0 -0
- {python_urlopen-0.1.6.1 → python_urlopen-0.1.6.3}/readme.md +0 -0
- {python_urlopen-0.1.6.1 → python_urlopen-0.1.6.3}/urlopen/__main__.py +0 -0
- {python_urlopen-0.1.6.1 → python_urlopen-0.1.6.3}/urlopen/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-urlopen
|
|
3
|
-
Version: 0.1.6.
|
|
3
|
+
Version: 0.1.6.3
|
|
4
4
|
Summary: Python urlopen wrapper.
|
|
5
5
|
Home-page: https://github.com/ChenyangGao/python-modules/tree/main/python-urlopen
|
|
6
6
|
License: MIT
|
|
@@ -20,7 +20,7 @@ Classifier: Programming Language :: Python :: 3 :: Only
|
|
|
20
20
|
Classifier: Topic :: Software Development
|
|
21
21
|
Classifier: Topic :: Software Development :: Libraries
|
|
22
22
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
-
Requires-Dist: http_client_request (>=0.0.
|
|
23
|
+
Requires-Dist: http_client_request (>=0.0.9.2)
|
|
24
24
|
Requires-Dist: http_response (>=0.0.9)
|
|
25
25
|
Requires-Dist: python-argtools (>=0.0.2)
|
|
26
26
|
Requires-Dist: python-cookietools (>=0.1.3)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "python-urlopen"
|
|
3
|
-
version = "0.1.6.
|
|
3
|
+
version = "0.1.6.3"
|
|
4
4
|
description = "Python urlopen wrapper."
|
|
5
5
|
authors = ["ChenyangGao <wosiwujm@gmail.com>"]
|
|
6
6
|
license = "MIT"
|
|
@@ -27,7 +27,7 @@ include = [
|
|
|
27
27
|
|
|
28
28
|
[tool.poetry.dependencies]
|
|
29
29
|
python = "^3.12"
|
|
30
|
-
http_client_request = ">=0.0.
|
|
30
|
+
http_client_request = ">=0.0.9.2"
|
|
31
31
|
http_response = ">=0.0.9"
|
|
32
32
|
python-argtools = ">=0.0.2"
|
|
33
33
|
python-cookietools = ">=0.1.3"
|
|
@@ -25,7 +25,7 @@ from urllib.request import (
|
|
|
25
25
|
|
|
26
26
|
from argtools import argcount
|
|
27
27
|
from cookietools import cookies_to_str, extract_cookies, update_cookies
|
|
28
|
-
from dicttools import iter_items
|
|
28
|
+
from dicttools import dict_map, iter_items
|
|
29
29
|
from filewrap import bio_skip_iter, SupportsRead, SupportsWrite
|
|
30
30
|
from http_client_request import ConnectionPool, HTTPResponse, CONNECTION_POOL
|
|
31
31
|
from http_request import normalize_request_args, SupportsGeturl
|
|
@@ -86,38 +86,36 @@ class KeepAliveBaseHTTPHandler(AbstractHTTPHandler):
|
|
|
86
86
|
origin = "https://" + host
|
|
87
87
|
else:
|
|
88
88
|
origin = "http://" + host
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
headers =
|
|
92
|
-
headers.update({
|
|
93
|
-
if k not in headers})
|
|
89
|
+
con = pool.get_connection(origin, timeout=req.timeout)
|
|
90
|
+
con.set_debuglevel(self._debuglevel) # type: ignore
|
|
91
|
+
headers = dict_map(req.unredirected_hdrs or (), key=str.lower)
|
|
92
|
+
headers.update({k0: v for k, v in req.headers.items()
|
|
93
|
+
if (k0 := k.lower()) not in headers})
|
|
94
94
|
headers.setdefault("connection", "keep-alive")
|
|
95
95
|
if req._tunnel_host:
|
|
96
96
|
tunnel_headers = {}
|
|
97
|
-
proxy_auth_hdr = "
|
|
97
|
+
proxy_auth_hdr = "proxy-authorization"
|
|
98
98
|
if proxy_auth_hdr in headers:
|
|
99
99
|
tunnel_headers[proxy_auth_hdr] = headers[proxy_auth_hdr]
|
|
100
100
|
del headers[proxy_auth_hdr]
|
|
101
|
-
|
|
101
|
+
con.set_tunnel(req._tunnel_host, headers=tunnel_headers)
|
|
102
102
|
else:
|
|
103
|
-
|
|
104
|
-
h._tunnel_port = None
|
|
105
|
-
h._tunnel_headers.clear()
|
|
103
|
+
con.set_tunnel()
|
|
106
104
|
try:
|
|
107
105
|
try:
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
con.request(req.get_method(), req.selector, req.data, headers,
|
|
107
|
+
encode_chunked=req.has_header('Transfer-encoding'))
|
|
110
108
|
except OSError as err:
|
|
111
109
|
raise URLError(err)
|
|
112
|
-
r =
|
|
110
|
+
r = con.getresponse()
|
|
113
111
|
except:
|
|
114
|
-
pool.return_connection(
|
|
112
|
+
pool.return_connection(con)
|
|
115
113
|
raise
|
|
116
114
|
r.url = req.get_full_url()
|
|
117
115
|
r.msg = r.reason
|
|
118
116
|
if headers.get("connection") == "keep-alive":
|
|
119
117
|
setattr(r, "pool", pool)
|
|
120
|
-
setattr(r, "connection",
|
|
118
|
+
setattr(r, "connection", con)
|
|
121
119
|
return r
|
|
122
120
|
|
|
123
121
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|