python-http_request 0.1.6__tar.gz → 0.1.6.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_http_request-0.1.6.2/PKG-INFO +94 -0
- {python_http_request-0.1.6 → python_http_request-0.1.6.2}/http_request/__init__.py +2 -0
- {python_http_request-0.1.6 → python_http_request-0.1.6.2}/http_request/extension/request.py +5 -1
- {python_http_request-0.1.6 → python_http_request-0.1.6.2}/pyproject.toml +2 -1
- python_http_request-0.1.6.2/readme.md +54 -0
- python_http_request-0.1.6/PKG-INFO +0 -53
- python_http_request-0.1.6/readme.md +0 -16
- {python_http_request-0.1.6 → python_http_request-0.1.6.2}/LICENSE +0 -0
- {python_http_request-0.1.6 → python_http_request-0.1.6.2}/http_request/extension/__init__.py +0 -0
- {python_http_request-0.1.6 → python_http_request-0.1.6.2}/http_request/py.typed +0 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: python-http_request
|
|
3
|
+
Version: 0.1.6.2
|
|
4
|
+
Summary: Python http request utils.
|
|
5
|
+
License: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: http,request
|
|
8
|
+
Author: ChenyangGao
|
|
9
|
+
Author-email: wosiwujm@gmail.com
|
|
10
|
+
Requires-Python: >=3.12,<4.0
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
21
|
+
Classifier: Topic :: Software Development
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Requires-Dist: http_response (>=0.0.9)
|
|
25
|
+
Requires-Dist: orjson
|
|
26
|
+
Requires-Dist: python-argtools (>=0.0.2)
|
|
27
|
+
Requires-Dist: python-asynctools (>=0.1.3)
|
|
28
|
+
Requires-Dist: python-cookietools (>=0.1.4)
|
|
29
|
+
Requires-Dist: python-dicttools (>=0.0.4)
|
|
30
|
+
Requires-Dist: python-ensure (>=0.0.1)
|
|
31
|
+
Requires-Dist: python-filewrap (>=0.2.8)
|
|
32
|
+
Requires-Dist: python-texttools (>=0.0.5)
|
|
33
|
+
Requires-Dist: python-undefined (>=0.0.3)
|
|
34
|
+
Requires-Dist: socket_keepalive (>=0.0.1)
|
|
35
|
+
Requires-Dist: yarl
|
|
36
|
+
Project-URL: Homepage, https://github.com/ChenyangGao/python-modules/tree/main/python-http_request
|
|
37
|
+
Project-URL: Repository, https://github.com/ChenyangGao/python-modules/tree/main/python-http_request
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
|
|
40
|
+
# Python http request utils.
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
You can install from [pypi](https://pypi.org/project/python-http_request/)
|
|
45
|
+
|
|
46
|
+
```console
|
|
47
|
+
pip install -U python-http_request
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
import http_request
|
|
54
|
+
import http_request.extension
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Extension
|
|
58
|
+
|
|
59
|
+
I've implemented several modules, all of which provide a ``request`` function. Their signatures are similar, so they can be used as drop-in replacements for each other.
|
|
60
|
+
|
|
61
|
+
1. [aiohttp_client_request](https://pypi.org/project/aiohttp_client_request/)
|
|
62
|
+
1. [aiosonic_request](https://pypi.org/project/aiosonic_request/)
|
|
63
|
+
1. [asks_request](https://pypi.org/project/asks_request/)
|
|
64
|
+
1. [blacksheep_client_request](https://pypi.org/project/blacksheep_client_request/)
|
|
65
|
+
1. [curl_cffi_request](https://pypi.org/project/curl_cffi_request/)
|
|
66
|
+
1. [http_client_request](https://pypi.org/project/http_client_request/)
|
|
67
|
+
1. [httpcore_request](https://pypi.org/project/httpcore_request/)
|
|
68
|
+
1. [httpx_request](https://pypi.org/project/httpx_request/)
|
|
69
|
+
1. [hyper_request](https://pypi.org/project/hyper_request/)
|
|
70
|
+
1. [pycurl_request](https://pypi.org/project/pycurl_request/)
|
|
71
|
+
1. [python-urlopen](https://pypi.org/project/python-urlopen/)
|
|
72
|
+
1. [requests_request](https://pypi.org/project/requests_request/)
|
|
73
|
+
1. [tornado_client_request](https://pypi.org/project/tornado_client_request/)
|
|
74
|
+
1. [urllib3_request](https://pypi.org/project/urllib3_request/)
|
|
75
|
+
|
|
76
|
+
To make it more general, I've encapsulated a ``request`` function
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
from http_request.extension import request
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
You just need to implement a ``urlopen`` function pass to ``request``, then it can be directly extended. The ``urlopen`` function signature is roughly as follows:
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
def urlopen[Response](
|
|
86
|
+
url: str,
|
|
87
|
+
method: str,
|
|
88
|
+
data=None,
|
|
89
|
+
headers: None | dict[str, str] = None,
|
|
90
|
+
**request_args,
|
|
91
|
+
) -> Response:
|
|
92
|
+
...
|
|
93
|
+
```
|
|
94
|
+
|
|
@@ -29,6 +29,7 @@ from filewrap import bio_chunk_iter, bio_chunk_async_iter, SupportsRead
|
|
|
29
29
|
from http_response import (
|
|
30
30
|
get_status_code, headers_get, decompress_response, parse_response,
|
|
31
31
|
)
|
|
32
|
+
from socket_keepalive import socket_keepalive
|
|
32
33
|
from yarl import URL
|
|
33
34
|
|
|
34
35
|
from .. import normalize_request_args, SupportsGeturl
|
|
@@ -147,8 +148,10 @@ def urlopen(
|
|
|
147
148
|
method: str = "GET",
|
|
148
149
|
data=None,
|
|
149
150
|
headers=None,
|
|
150
|
-
**
|
|
151
|
+
**request_kwargs,
|
|
151
152
|
) -> HTTPResponse:
|
|
153
|
+
if headers is None:
|
|
154
|
+
headers = {}
|
|
152
155
|
urlp = urlsplit(url)
|
|
153
156
|
if urlp.scheme == "https":
|
|
154
157
|
con: HTTPConnection = HTTPSConnection(urlp.netloc)
|
|
@@ -160,6 +163,7 @@ def urlopen(
|
|
|
160
163
|
data,
|
|
161
164
|
headers,
|
|
162
165
|
)
|
|
166
|
+
socket_keepalive(con.sock)
|
|
163
167
|
return con.getresponse()
|
|
164
168
|
|
|
165
169
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "python-http_request"
|
|
3
|
-
version = "0.1.6"
|
|
3
|
+
version = "0.1.6.2"
|
|
4
4
|
description = "Python http request utils."
|
|
5
5
|
authors = ["ChenyangGao <wosiwujm@gmail.com>"]
|
|
6
6
|
license = "MIT"
|
|
@@ -37,6 +37,7 @@ python-ensure = ">=0.0.1"
|
|
|
37
37
|
python-filewrap = ">=0.2.8"
|
|
38
38
|
python-texttools = ">=0.0.5"
|
|
39
39
|
python-undefined = ">=0.0.3"
|
|
40
|
+
socket_keepalive = ">=0.0.1"
|
|
40
41
|
yarl = "*"
|
|
41
42
|
|
|
42
43
|
[build-system]
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Python http request utils.
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
You can install from [pypi](https://pypi.org/project/python-http_request/)
|
|
6
|
+
|
|
7
|
+
```console
|
|
8
|
+
pip install -U python-http_request
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
import http_request
|
|
15
|
+
import http_request.extension
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Extension
|
|
19
|
+
|
|
20
|
+
I've implemented several modules, all of which provide a ``request`` function. Their signatures are similar, so they can be used as drop-in replacements for each other.
|
|
21
|
+
|
|
22
|
+
1. [aiohttp_client_request](https://pypi.org/project/aiohttp_client_request/)
|
|
23
|
+
1. [aiosonic_request](https://pypi.org/project/aiosonic_request/)
|
|
24
|
+
1. [asks_request](https://pypi.org/project/asks_request/)
|
|
25
|
+
1. [blacksheep_client_request](https://pypi.org/project/blacksheep_client_request/)
|
|
26
|
+
1. [curl_cffi_request](https://pypi.org/project/curl_cffi_request/)
|
|
27
|
+
1. [http_client_request](https://pypi.org/project/http_client_request/)
|
|
28
|
+
1. [httpcore_request](https://pypi.org/project/httpcore_request/)
|
|
29
|
+
1. [httpx_request](https://pypi.org/project/httpx_request/)
|
|
30
|
+
1. [hyper_request](https://pypi.org/project/hyper_request/)
|
|
31
|
+
1. [pycurl_request](https://pypi.org/project/pycurl_request/)
|
|
32
|
+
1. [python-urlopen](https://pypi.org/project/python-urlopen/)
|
|
33
|
+
1. [requests_request](https://pypi.org/project/requests_request/)
|
|
34
|
+
1. [tornado_client_request](https://pypi.org/project/tornado_client_request/)
|
|
35
|
+
1. [urllib3_request](https://pypi.org/project/urllib3_request/)
|
|
36
|
+
|
|
37
|
+
To make it more general, I've encapsulated a ``request`` function
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from http_request.extension import request
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
You just need to implement a ``urlopen`` function pass to ``request``, then it can be directly extended. The ``urlopen`` function signature is roughly as follows:
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
def urlopen[Response](
|
|
47
|
+
url: str,
|
|
48
|
+
method: str,
|
|
49
|
+
data=None,
|
|
50
|
+
headers: None | dict[str, str] = None,
|
|
51
|
+
**request_args,
|
|
52
|
+
) -> Response:
|
|
53
|
+
...
|
|
54
|
+
```
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: python-http_request
|
|
3
|
-
Version: 0.1.6
|
|
4
|
-
Summary: Python http request utils.
|
|
5
|
-
Home-page: https://github.com/ChenyangGao/python-modules/tree/main/python-http_request
|
|
6
|
-
License: MIT
|
|
7
|
-
Keywords: http,request
|
|
8
|
-
Author: ChenyangGao
|
|
9
|
-
Author-email: wosiwujm@gmail.com
|
|
10
|
-
Requires-Python: >=3.12,<4.0
|
|
11
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
-
Classifier: Intended Audience :: Developers
|
|
13
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
-
Classifier: Operating System :: OS Independent
|
|
15
|
-
Classifier: Programming Language :: Python
|
|
16
|
-
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
|
-
Classifier: Topic :: Software Development
|
|
21
|
-
Classifier: Topic :: Software Development :: Libraries
|
|
22
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
-
Requires-Dist: http_response (>=0.0.9)
|
|
24
|
-
Requires-Dist: orjson
|
|
25
|
-
Requires-Dist: python-argtools (>=0.0.2)
|
|
26
|
-
Requires-Dist: python-asynctools (>=0.1.3)
|
|
27
|
-
Requires-Dist: python-cookietools (>=0.1.4)
|
|
28
|
-
Requires-Dist: python-dicttools (>=0.0.4)
|
|
29
|
-
Requires-Dist: python-ensure (>=0.0.1)
|
|
30
|
-
Requires-Dist: python-filewrap (>=0.2.8)
|
|
31
|
-
Requires-Dist: python-texttools (>=0.0.5)
|
|
32
|
-
Requires-Dist: python-undefined (>=0.0.3)
|
|
33
|
-
Requires-Dist: yarl
|
|
34
|
-
Project-URL: Repository, https://github.com/ChenyangGao/python-modules/tree/main/python-http_request
|
|
35
|
-
Description-Content-Type: text/markdown
|
|
36
|
-
|
|
37
|
-
# Python http request utils.
|
|
38
|
-
|
|
39
|
-
## Installation
|
|
40
|
-
|
|
41
|
-
You can install from [pypi](https://pypi.org/project/python-http_request/)
|
|
42
|
-
|
|
43
|
-
```console
|
|
44
|
-
pip install -U python-http_request
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Usage
|
|
48
|
-
|
|
49
|
-
```python
|
|
50
|
-
import http_request
|
|
51
|
-
import http_request.extension
|
|
52
|
-
```
|
|
53
|
-
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Python http request utils.
|
|
2
|
-
|
|
3
|
-
## Installation
|
|
4
|
-
|
|
5
|
-
You can install from [pypi](https://pypi.org/project/python-http_request/)
|
|
6
|
-
|
|
7
|
-
```console
|
|
8
|
-
pip install -U python-http_request
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
```python
|
|
14
|
-
import http_request
|
|
15
|
-
import http_request.extension
|
|
16
|
-
```
|
|
File without changes
|
{python_http_request-0.1.6 → python_http_request-0.1.6.2}/http_request/extension/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|