python-http_request 0.1.6.2__tar.gz → 0.1.6.4__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_http_request-0.1.6.2 → python_http_request-0.1.6.4}/PKG-INFO +1 -1
- {python_http_request-0.1.6.2 → python_http_request-0.1.6.4}/http_request/__init__.py +8 -6
- {python_http_request-0.1.6.2 → python_http_request-0.1.6.4}/http_request/extension/request.py +5 -4
- {python_http_request-0.1.6.2 → python_http_request-0.1.6.4}/pyproject.toml +1 -1
- {python_http_request-0.1.6.2 → python_http_request-0.1.6.4}/LICENSE +0 -0
- {python_http_request-0.1.6.2 → python_http_request-0.1.6.4}/http_request/extension/__init__.py +0 -0
- {python_http_request-0.1.6.2 → python_http_request-0.1.6.4}/http_request/py.typed +0 -0
- {python_http_request-0.1.6.2 → python_http_request-0.1.6.4}/readme.md +0 -0
|
@@ -253,16 +253,17 @@ def encode_multipart_data(
|
|
|
253
253
|
match value:
|
|
254
254
|
case [value]:
|
|
255
255
|
pass
|
|
256
|
-
case [
|
|
256
|
+
case [filename, value]:
|
|
257
257
|
pass
|
|
258
|
-
case [
|
|
258
|
+
case [filename, value, file_type]:
|
|
259
259
|
if file_type:
|
|
260
260
|
headers[b"content-type"] = ensure_bytes_(file_type)
|
|
261
|
-
case [
|
|
261
|
+
case [filename, value, file_type, file_headers, *rest]:
|
|
262
262
|
for k, v in iter_items(file_headers):
|
|
263
263
|
headers[ensure_bytes_(k).lower()] = ensure_bytes_(v)
|
|
264
264
|
if file_type:
|
|
265
265
|
headers[b"content-type"] = ensure_bytes_(file_type)
|
|
266
|
+
filename = ensure_bytes_(filename)
|
|
266
267
|
if isinstance(value, (PathLike, SupportsRead)):
|
|
267
268
|
is_file = True
|
|
268
269
|
if isinstance(value, PathLike):
|
|
@@ -347,16 +348,17 @@ def encode_multipart_data_async(
|
|
|
347
348
|
match value:
|
|
348
349
|
case [value]:
|
|
349
350
|
pass
|
|
350
|
-
case [
|
|
351
|
+
case [filename, value]:
|
|
351
352
|
pass
|
|
352
|
-
case [
|
|
353
|
+
case [filename, value, file_type]:
|
|
353
354
|
if file_type:
|
|
354
355
|
headers[b"content-type"] = ensure_bytes_(file_type)
|
|
355
|
-
case [
|
|
356
|
+
case [filename, value, file_type, file_headers, *rest]:
|
|
356
357
|
for k, v in iter_items(file_headers):
|
|
357
358
|
headers[ensure_bytes_(k).lower()] = ensure_bytes_(v)
|
|
358
359
|
if file_type:
|
|
359
360
|
headers[b"content-type"] = ensure_bytes_(file_type)
|
|
361
|
+
filename = ensure_bytes_(filename)
|
|
360
362
|
if isinstance(value, (PathLike, SupportsRead)):
|
|
361
363
|
is_file = True
|
|
362
364
|
if isinstance(value, PathLike):
|
{python_http_request-0.1.6.2 → python_http_request-0.1.6.4}/http_request/extension/request.py
RENAMED
|
@@ -150,8 +150,6 @@ def urlopen(
|
|
|
150
150
|
headers=None,
|
|
151
151
|
**request_kwargs,
|
|
152
152
|
) -> HTTPResponse:
|
|
153
|
-
if headers is None:
|
|
154
|
-
headers = {}
|
|
155
153
|
urlp = urlsplit(url)
|
|
156
154
|
if urlp.scheme == "https":
|
|
157
155
|
con: HTTPConnection = HTTPSConnection(urlp.netloc)
|
|
@@ -161,10 +159,13 @@ def urlopen(
|
|
|
161
159
|
method,
|
|
162
160
|
urlunsplit(urlp._replace(scheme="", netloc="")),
|
|
163
161
|
data,
|
|
164
|
-
headers,
|
|
162
|
+
{} if headers is None else headers,
|
|
165
163
|
)
|
|
166
164
|
socket_keepalive(con.sock)
|
|
167
|
-
|
|
165
|
+
resp = con.getresponse()
|
|
166
|
+
setattr(resp, "method", method.upper())
|
|
167
|
+
setattr(resp, "url", url)
|
|
168
|
+
return resp
|
|
168
169
|
|
|
169
170
|
|
|
170
171
|
urlopen_async = lambda *a, **k: to_thread(urlopen, *a, **k)
|
|
File without changes
|
{python_http_request-0.1.6.2 → python_http_request-0.1.6.4}/http_request/extension/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|