rnet 3.0.0rc1__cp311-abi3-macosx_11_0_arm64.whl → 3.0.0rc2__cp311-abi3-macosx_11_0_arm64.whl

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.

Potentially problematic release.


This version of rnet might be problematic. Click here for more details.

rnet/__init__.pyi CHANGED
@@ -23,9 +23,57 @@ try:
23
23
  except ImportError:
24
24
  from typing_extensions import Unpack, NotRequired
25
25
 
26
+ class ClientParams(TypedDict, closed=True):
27
+ emulation: NotRequired[Union[Emulation, EmulationOption]]
28
+ user_agent: NotRequired[str]
29
+ headers: NotRequired[Union[Dict[str, str], HeaderMap]]
30
+ orig_headers: NotRequired[Union[List[str], OrigHeaderMap]]
31
+ referer: NotRequired[bool]
32
+ allow_redirects: NotRequired[bool]
33
+ max_redirects: NotRequired[int]
34
+ cookie_store: NotRequired[bool]
35
+ cookie_provider: NotRequired[Jar]
36
+ timeout: NotRequired[int]
37
+ connect_timeout: NotRequired[int]
38
+ read_timeout: NotRequired[int]
39
+ tcp_keepalive: NotRequired[int]
40
+ tcp_keepalive_interval: NotRequired[int]
41
+ tcp_keepalive_retries: NotRequired[int]
42
+ tcp_user_timeout: NotRequired[int]
43
+ tcp_nodelay: NotRequired[bool]
44
+ tcp_reuse_address: NotRequired[bool]
45
+ pool_idle_timeout: NotRequired[int]
46
+ pool_max_idle_per_host: NotRequired[int]
47
+ pool_max_size: NotRequired[int]
48
+ http1_only: NotRequired[bool]
49
+ http2_only: NotRequired[bool]
50
+ https_only: NotRequired[bool]
51
+ http2_max_retry_count: NotRequired[int]
52
+ verify: NotRequired[Union[bool, Path, CertStore]]
53
+ identity: NotRequired[Identity]
54
+ keylog: NotRequired[KeyLogPolicy]
55
+ tls_info: NotRequired[bool]
56
+ min_tls_version: NotRequired[TlsVersion]
57
+ max_tls_version: NotRequired[TlsVersion]
58
+ no_proxy: NotRequired[bool]
59
+ proxies: NotRequired[List[Proxy]]
60
+ local_address: NotRequired[Union[str, ipaddress.IPv4Address, ipaddress.IPv6Address]]
61
+ interface: NotRequired[str]
62
+ gzip: NotRequired[bool]
63
+ brotli: NotRequired[bool]
64
+ deflate: NotRequired[bool]
65
+ zstd: NotRequired[bool]
66
+
67
+ class ProxyParams(TypedDict, closed=True):
68
+ username: NotRequired[str]
69
+ password: NotRequired[str]
70
+ custom_http_auth: NotRequired[str]
71
+ custom_http_headers: NotRequired[Union[Dict[str, str], HeaderMap]]
72
+ exclusion: NotRequired[str]
73
+
26
74
  class Request(TypedDict, closed=True):
27
75
  emulation: NotRequired[Union[Emulation, EmulationOption]]
28
- proxy: NotRequired[Union[str, Proxy]]
76
+ proxy: NotRequired[Proxy]
29
77
  local_address: NotRequired[Union[ipaddress.IPv4Address, ipaddress.IPv6Address]]
30
78
  interface: NotRequired[str]
31
79
  timeout: NotRequired[int]
@@ -59,7 +107,7 @@ class Request(TypedDict, closed=True):
59
107
 
60
108
  class WebSocketRequest(TypedDict, closed=True):
61
109
  emulation: NotRequired[Union[Emulation, EmulationOption]]
62
- proxy: NotRequired[Union[str, Proxy]]
110
+ proxy: NotRequired[Proxy]
63
111
  local_address: NotRequired[Union[str, ipaddress.IPv4Address, ipaddress.IPv6Address]]
64
112
  interface: NotRequired[str]
65
113
  headers: NotRequired[Union[Dict[str, str], HeaderMap]]
@@ -79,62 +127,14 @@ class WebSocketRequest(TypedDict, closed=True):
79
127
  max_frame_size: NotRequired[int]
80
128
  accept_unmasked_frames: NotRequired[bool]
81
129
 
82
- class ProxyParams(TypedDict, closed=True):
83
- username: NotRequired[str]
84
- password: NotRequired[str]
85
- custom_http_auth: NotRequired[str]
86
- custom_http_headers: NotRequired[Union[Dict[str, str], HeaderMap]]
87
- exclusion: NotRequired[str]
88
-
89
130
  class Client:
90
131
  r"""
91
132
  A client for making HTTP requests.
92
133
  """
93
134
 
94
- def __new__(
135
+ def __init__(
95
136
  cls,
96
- emulation: Optional[Union[Emulation, EmulationOption]] = None,
97
- user_agent: Optional[str] = None,
98
- headers: Optional[Union[Dict[str, str], HeaderMap]] = None,
99
- orig_headers: Optional[Union[List[str], OrigHeaderMap]] = None,
100
- referer: Optional[bool] = None,
101
- allow_redirects: Optional[bool] = None,
102
- max_redirects: Optional[int] = None,
103
- cookie_store: Optional[bool] = None,
104
- cookie_provider: Optional[Jar] = None,
105
- timeout: Optional[int] = None,
106
- connect_timeout: Optional[int] = None,
107
- read_timeout: Optional[int] = None,
108
- no_keepalive: Optional[bool] = None,
109
- tcp_keepalive: Optional[int] = None,
110
- tcp_keepalive_interval: Optional[int] = None,
111
- tcp_keepalive_retries: Optional[int] = None,
112
- tcp_user_timeout: Optional[int] = None,
113
- tcp_nodelay: Optional[bool] = None,
114
- tcp_reuse_address: Optional[bool] = None,
115
- pool_idle_timeout: Optional[int] = None,
116
- pool_max_idle_per_host: Optional[int] = None,
117
- pool_max_size: Optional[int] = None,
118
- http1_only: Optional[bool] = None,
119
- http2_only: Optional[bool] = None,
120
- https_only: Optional[bool] = None,
121
- http2_max_retry_count: Optional[int] = None,
122
- verify: Optional[Union[bool, Path, CertStore]] = None,
123
- identity: Optional[Identity] = None,
124
- keylog: Optional[KeyLogPolicy] = None,
125
- tls_info: Optional[bool] = None,
126
- min_tls_version: Optional[TlsVersion] = None,
127
- max_tls_version: Optional[TlsVersion] = None,
128
- no_proxy: Optional[bool] = None,
129
- proxies: Optional[List[Proxy]] = None,
130
- local_address: Optional[
131
- Union[str, ipaddress.IPv4Address, ipaddress.IPv6Address]
132
- ] = None,
133
- interface: Optional[str] = None,
134
- gzip: Optional[bool] = None,
135
- brotli: Optional[bool] = None,
136
- deflate: Optional[bool] = None,
137
- zstd: Optional[bool] = None,
137
+ **kwargs: Unpack[ClientParams],
138
138
  ) -> Client:
139
139
  r"""
140
140
  Creates a new Client instance.
@@ -152,7 +152,6 @@ class Client:
152
152
  timeout: Total timeout (seconds).
153
153
  connect_timeout: Connection timeout (seconds).
154
154
  read_timeout: Read timeout (seconds).
155
- no_keepalive: Disable HTTP keep-alive.
156
155
  tcp_keepalive: TCP keepalive time (seconds).
157
156
  tcp_keepalive_interval: TCP keepalive interval (seconds).
158
157
  tcp_keepalive_retries: TCP keepalive retry count.
@@ -444,7 +443,7 @@ class Multipart:
444
443
  A multipart form for a request.
445
444
  """
446
445
 
447
- def __new__(cls, *parts) -> Multipart:
446
+ def __init__(cls, *parts) -> Multipart:
448
447
  r"""
449
448
  Creates a new multipart form.
450
449
  """
@@ -454,7 +453,7 @@ class Part:
454
453
  A part of a multipart form.
455
454
  """
456
455
 
457
- def __new__(
456
+ def __init__(
458
457
  cls,
459
458
  name: str,
460
459
  value: Union[
@@ -533,6 +532,10 @@ class Response:
533
532
  r"""
534
533
  Returns the remote address of the response.
535
534
  """
535
+ local_addr: Optional[SocketAddr]
536
+ r"""
537
+ Returns the local address of the response.
538
+ """
536
539
  encoding: str
537
540
  r"""
538
541
  Encoding to decode with when accessing text.
rnet/blocking.py CHANGED
@@ -1,21 +1,15 @@
1
1
  from typing import Unpack
2
- from rnet import Message, Proxy, Request, Streamer, WebSocketRequest
3
- import ipaddress
2
+ from rnet import ClientParams, Message, Request, Streamer, WebSocketRequest
4
3
  from typing import (
5
4
  Optional,
6
- Union,
7
5
  Any,
8
- Dict,
9
6
  List,
10
7
  Unpack,
11
8
  )
12
- from pathlib import Path
13
9
 
14
10
  from rnet import Version, Method, SocketAddr, StatusCode
15
- from rnet.tls import CertStore, KeyLogPolicy, TlsVersion, Identity
16
- from rnet.header import HeaderMap, OrigHeaderMap
17
- from rnet.cookie import Cookie, Jar
18
- from rnet.emulation import EmulationOption, Emulation
11
+ from rnet.header import HeaderMap
12
+ from rnet.cookie import Cookie
19
13
 
20
14
 
21
15
  class Client:
@@ -23,50 +17,9 @@ class Client:
23
17
  A blocking client for making HTTP requests.
24
18
  """
25
19
 
26
- def __new__(
20
+ def __init__(
27
21
  cls,
28
- emulation: Optional[Union[Emulation, EmulationOption]] = None,
29
- user_agent: Optional[str] = None,
30
- headers: Optional[Union[Dict[str, str], HeaderMap]] = None,
31
- orig_headers: Optional[Union[List[str], OrigHeaderMap]] = None,
32
- referer: Optional[bool] = None,
33
- allow_redirects: Optional[bool] = None,
34
- max_redirects: Optional[int] = None,
35
- cookie_store: Optional[bool] = None,
36
- cookie_provider: Optional[Jar] = None,
37
- timeout: Optional[int] = None,
38
- connect_timeout: Optional[int] = None,
39
- read_timeout: Optional[int] = None,
40
- no_keepalive: Optional[bool] = None,
41
- tcp_keepalive: Optional[int] = None,
42
- tcp_keepalive_interval: Optional[int] = None,
43
- tcp_keepalive_retries: Optional[int] = None,
44
- tcp_user_timeout: Optional[int] = None,
45
- tcp_nodelay: Optional[bool] = None,
46
- tcp_reuse_address: Optional[bool] = None,
47
- pool_idle_timeout: Optional[int] = None,
48
- pool_max_idle_per_host: Optional[int] = None,
49
- pool_max_size: Optional[int] = None,
50
- http1_only: Optional[bool] = None,
51
- http2_only: Optional[bool] = None,
52
- https_only: Optional[bool] = None,
53
- http2_max_retry_count: Optional[int] = None,
54
- verify: Optional[Union[bool, Path, CertStore]] = None,
55
- identity: Optional[Identity] = None,
56
- keylog: Optional[KeyLogPolicy] = None,
57
- tls_info: Optional[bool] = None,
58
- min_tls_version: Optional[TlsVersion] = None,
59
- max_tls_version: Optional[TlsVersion] = None,
60
- no_proxy: Optional[bool] = None,
61
- proxies: Optional[List[Proxy]] = None,
62
- local_address: Optional[
63
- Union[str, ipaddress.IPv4Address, ipaddress.IPv6Address]
64
- ] = None,
65
- interface: Optional[str] = None,
66
- gzip: Optional[bool] = None,
67
- brotli: Optional[bool] = None,
68
- deflate: Optional[bool] = None,
69
- zstd: Optional[bool] = None,
22
+ **kwargs: Unpack[ClientParams],
70
23
  ) -> "Client":
71
24
  r"""
72
25
  Creates a new blocking Client instance.
@@ -84,7 +37,6 @@ class Client:
84
37
  timeout: Total timeout (seconds).
85
38
  connect_timeout: Connection timeout (seconds).
86
39
  read_timeout: Read timeout (seconds).
87
- no_keepalive: Disable HTTP keep-alive.
88
40
  tcp_keepalive: TCP keepalive time (seconds).
89
41
  tcp_keepalive_interval: TCP keepalive interval (seconds).
90
42
  tcp_keepalive_retries: TCP keepalive retry count.
@@ -401,6 +353,10 @@ class Response:
401
353
  r"""
402
354
  Returns the remote address of the response.
403
355
  """
356
+ local_addr: Optional[SocketAddr]
357
+ r"""
358
+ Returns the local address of the response.
359
+ """
404
360
  encoding: str
405
361
  r"""
406
362
  Encoding to decode with when accessing text.
rnet/cookie.py CHANGED
@@ -8,7 +8,7 @@ and provides a cookie jar for automatic cookie handling during HTTP requests.
8
8
 
9
9
  import datetime
10
10
  from enum import Enum, auto
11
- from typing import Optional
11
+ from typing import List, Optional
12
12
 
13
13
 
14
14
  class SameSite(Enum):
@@ -67,17 +67,17 @@ class Cookie:
67
67
  The cookie expiration time.
68
68
  """
69
69
 
70
- def __new__(
70
+ def __init__(
71
71
  cls,
72
72
  name: str,
73
73
  value: str,
74
- domain: Optional[str] = None,
75
- path: Optional[str] = None,
76
- max_age: Optional[datetime.timedelta] = None,
77
- expires: Optional[datetime.datetime] = None,
74
+ domain: str | None = None,
75
+ path: str | None = None,
76
+ max_age: datetime.timedelta | None = None,
77
+ expires: datetime.datetime | None = None,
78
78
  http_only: bool = False,
79
79
  secure: bool = False,
80
- same_site: Optional[SameSite] = None,
80
+ same_site: SameSite | None = None,
81
81
  ) -> "Cookie":
82
82
  r"""
83
83
  Create a new cookie.
@@ -94,7 +94,7 @@ class Jar:
94
94
  to automatically handle cookies during HTTP requests and responses.
95
95
  """
96
96
 
97
- def __new__(cls) -> "Jar":
97
+ def __init__(cls) -> "Jar":
98
98
  r"""
99
99
  Create a new cookie jar.
100
100
  """
@@ -104,7 +104,7 @@ class Jar:
104
104
  Get a cookie by name and URL.
105
105
  """
106
106
 
107
- def get_all(self) -> list[Cookie]:
107
+ def get_all(self) -> List[Cookie]:
108
108
  r"""
109
109
  Get all cookies.
110
110
  """
rnet/emulation.py CHANGED
@@ -131,12 +131,12 @@ class EmulationOption:
131
131
  browser types with specific operating systems.
132
132
  """
133
133
 
134
- def __new__(
134
+ def __init__(
135
135
  cls,
136
136
  emulation: Emulation,
137
- emulation_os: Optional[EmulationOS] = None,
138
- skip_http2: Optional[bool] = None,
139
- skip_headers: Optional[bool] = None,
137
+ emulation_os: EmulationOS | None = None,
138
+ skip_http2: bool | None = None,
139
+ skip_headers: bool | None = None,
140
140
  ) -> "EmulationOption":
141
141
  """
142
142
  Create a new emulation configuration.
rnet/header.py CHANGED
@@ -55,7 +55,7 @@ class HeaderMap:
55
55
  """Return a string representation of all headers."""
56
56
  ...
57
57
 
58
- def __new__(
58
+ def __init__(
59
59
  cls, init: Optional[dict] = None, capacity: Optional[int] = None
60
60
  ) -> "HeaderMap":
61
61
  """
@@ -108,12 +108,6 @@ class HeaderMap:
108
108
  Args:
109
109
  key: The header name (case-insensitive)
110
110
  value: The header value to set
111
-
112
- Example:
113
- ```python
114
- headers.insert('Content-Type', 'application/json')
115
- # Replaces any existing Content-Type header
116
- ```
117
111
  """
118
112
 
119
113
  def append(self, key: str, value: str) -> None:
@@ -127,13 +121,6 @@ class HeaderMap:
127
121
  Args:
128
122
  key: The header name (case-insensitive)
129
123
  value: The header value to append
130
-
131
- Example:
132
- ```python
133
- headers.append('Accept-Encoding', 'gzip')
134
- headers.append('Accept-Encoding', 'deflate')
135
- # Results in: Accept-Encoding: gzip, deflate
136
- ```
137
124
  """
138
125
 
139
126
  def remove(self, key: str) -> None:
@@ -161,12 +148,6 @@ class HeaderMap:
161
148
 
162
149
  Returns:
163
150
  The first header value as bytes, or the default value
164
-
165
- Example:
166
- ```python
167
- content_type = headers.get('Content-Type', b'text/plain')
168
- auth = headers.get('Authorization') # Returns None if missing
169
- ```
170
151
  """
171
152
 
172
153
  def get_all(self, key: str) -> "HeaderMapValuesIter":
@@ -182,16 +163,6 @@ class HeaderMap:
182
163
 
183
164
  Returns:
184
165
  An iterator over all header values
185
-
186
- Example:
187
- ```python
188
- # Get all Set-Cookie headers
189
- cookies = list(headers.get_all('Set-Cookie'))
190
-
191
- # Process multiple Accept-Encoding values
192
- for encoding in headers.get_all('Accept-Encoding'):
193
- print(f"Accepts: {encoding.decode()}")
194
- ```
195
166
  """
196
167
 
197
168
  def len(self) -> int:
@@ -243,12 +214,6 @@ class HeaderMap:
243
214
 
244
215
  Returns:
245
216
  Iterator over (name, value) tuples
246
-
247
- Example:
248
- ```python
249
- for name, value in headers.items():
250
- print(f"{name.decode()}: {value.decode()}")
251
- ```
252
217
  """
253
218
 
254
219
 
rnet/rnet.abi3.so CHANGED
Binary file
rnet/tls.py CHANGED
@@ -62,11 +62,11 @@ class CertStore:
62
62
  Represents a certificate store for verifying TLS connections.
63
63
  """
64
64
 
65
- def __new__(
65
+ def __init__(
66
66
  cls,
67
- der_certs: Optional[List[bytes]] = None,
68
- pem_certs: Optional[List[str]] = None,
69
- default_paths: Optional[bool] = None,
67
+ der_certs: List[bytes] | None = None,
68
+ pem_certs: List[str] | None = None,
69
+ default_paths: bool | None = None,
70
70
  ) -> "CertStore":
71
71
  """
72
72
  Creates a new CertStore.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rnet
3
- Version: 3.0.0rc1
3
+ Version: 3.0.0rc2
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -60,7 +60,7 @@ A blazing-fast Python HTTP client with advanced browser fingerprinting that accu
60
60
  This asynchronous example demonstrates how to make a simple GET request using the `rnet` library. So you need install `rnet` and run the following code:
61
61
 
62
62
  ```bash
63
- pip install asyncio rnet==3.0.0rc1
63
+ pip install asyncio rnet==3.0.0rc2
64
64
  ```
65
65
 
66
66
  And then the code:
@@ -0,0 +1,14 @@
1
+ rnet-3.0.0rc2.dist-info/METADATA,sha256=sYMR4YlcAy5Frl9GSKxIIuPDcnTBZty-D1l8OfnxDRc,10047
2
+ rnet-3.0.0rc2.dist-info/WHEEL,sha256=cVaoL47Ex1FxzwnkO_WCjy3a1Wl6mtZbBPTvTiNCHdY,103
3
+ rnet-3.0.0rc2.dist-info/licenses/LICENSE,sha256=ryRV02Zq6zAIr1heqDUkcGlpP7gVCDF6AqR4wRa82kI,35153
4
+ rnet/__init__.py,sha256=gqet5qGPHqS1VRr8XjzpQOuYetNn-aLss4lTR7cZ_9M,317
5
+ rnet/__init__.pyi,sha256=kJeqrw-tbxxYhNi0LVBSVEVU4OjZGV9--qydDZuSQh8,29217
6
+ rnet/blocking.py,sha256=FyisL3Hqdz6Oeq1e3LXgVcVW_-hmrF-rI3RgSWkaWN0,11447
7
+ rnet/cookie.py,sha256=7RIGN5PvA3JoZ4WS6gpJjB8OgUqyx1pYBk6SefJRa2A,2870
8
+ rnet/emulation.py,sha256=3DLfnKGQDIXlkyfF32B8na3_MOIpeTDkywRXtocI8jQ,5021
9
+ rnet/exceptions.py,sha256=pr8RNPhr_CswkdKgZGvamSFwyrHE6OPQk72YcJACNBo,5906
10
+ rnet/header.py,sha256=XycnM2sejBt_JauZIdM3ejywD3iX4GJQP10cAPSNLyU,11863
11
+ rnet/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ rnet/rnet.abi3.so,sha256=3oQj6gUfgJELzXv_QBMQx4hOk5KfBgN76i1PmtEErfc,7408848
13
+ rnet/tls.py,sha256=v-BFEiNRcfmYMqP2Bgeyig-Jzyw6ncjx39qSf2Ad_Oc,4803
14
+ rnet-3.0.0rc2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: maturin (1.9.3)
2
+ Generator: maturin (1.9.4)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp311-abi3-macosx_11_0_arm64
@@ -1,14 +0,0 @@
1
- rnet-3.0.0rc1.dist-info/METADATA,sha256=I7WMxAsKWF5uU6WfLht1LeD4N-mMvAc3XGQ6p-FvDkw,10047
2
- rnet-3.0.0rc1.dist-info/WHEEL,sha256=6FsaH53F12OzO11ZB57hTDesKbBIcqCM7w19loA4k_Q,103
3
- rnet-3.0.0rc1.dist-info/licenses/LICENSE,sha256=ryRV02Zq6zAIr1heqDUkcGlpP7gVCDF6AqR4wRa82kI,35153
4
- rnet/__init__.py,sha256=gqet5qGPHqS1VRr8XjzpQOuYetNn-aLss4lTR7cZ_9M,317
5
- rnet/__init__.pyi,sha256=g74_wT2p_7-TGKTYr5xSoDCxFkn34OU1Glz4UzTnGW8,29521
6
- rnet/blocking.py,sha256=Xo8CwyuhyEd-k6D88nbTIB1aLb-wUbDZNy2-AaXcdrw,13536
7
- rnet/cookie.py,sha256=fN8V-OKr-LT3psv9XTvHfnPD8Nwp10Awxxg762ScwP0,2877
8
- rnet/emulation.py,sha256=i3Qv1-c0wtWgxJ_hOlS6AFjNDIO4GsSP2SvRONRS6FI,5029
9
- rnet/exceptions.py,sha256=pr8RNPhr_CswkdKgZGvamSFwyrHE6OPQk72YcJACNBo,5906
10
- rnet/header.py,sha256=xbBb0wWKZRUs2ylldU_sN13QYBUDvZ-3zynCBd4UiYs,12955
11
- rnet/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- rnet/rnet.abi3.so,sha256=Ade9nQvMYmOskL5i_8aWEQmeg5uZ_t4_ux6LofgjfiA,7410816
13
- rnet/tls.py,sha256=Ko0h58k3twVyycuqK7zgBtN3JLnhZ8oDUZqANJshEDE,4811
14
- rnet-3.0.0rc1.dist-info/RECORD,,