rnet 2.4.2__cp313-cp313t-manylinux_2_34_armv7l.whl → 3.0.0rc10__cp313-cp313t-manylinux_2_34_armv7l.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__.py +11 -3
- rnet/__init__.pyi +1044 -799
- rnet/blocking.py +434 -1
- rnet/cookie.py +141 -1
- rnet/emulation.py +199 -0
- rnet/exceptions.py +224 -1
- rnet/header.py +319 -1
- rnet/http1.py +68 -0
- rnet/http2.py +361 -0
- rnet/rnet.cpython-313t-arm-linux-gnueabihf.so +0 -0
- rnet/tls.py +428 -0
- rnet-3.0.0rc10.dist-info/METADATA +205 -0
- rnet-3.0.0rc10.dist-info/RECORD +16 -0
- {rnet-2.4.2.dist-info → rnet-3.0.0rc10.dist-info}/WHEEL +1 -1
- rnet-3.0.0rc10.dist-info/licenses/LICENSE +201 -0
- rnet/blocking.pyi +0 -616
- rnet/cookie.pyi +0 -76
- rnet/exceptions.pyi +0 -64
- rnet/header.pyi +0 -103
- rnet/impersonate.py +0 -1
- rnet/impersonate.pyi +0 -147
- rnet-2.4.2.dist-info/METADATA +0 -186
- rnet-2.4.2.dist-info/RECORD +0 -18
- rnet-2.4.2.dist-info/licenses/LICENSE +0 -674
rnet/blocking.pyi
DELETED
|
@@ -1,616 +0,0 @@
|
|
|
1
|
-
from typing import Unpack
|
|
2
|
-
from rnet import Message, Proxy, RequestParams, WebSocketParams
|
|
3
|
-
import ipaddress
|
|
4
|
-
from typing import (
|
|
5
|
-
Optional,
|
|
6
|
-
Union,
|
|
7
|
-
Any,
|
|
8
|
-
Dict,
|
|
9
|
-
List,
|
|
10
|
-
Unpack,
|
|
11
|
-
)
|
|
12
|
-
from pathlib import Path
|
|
13
|
-
|
|
14
|
-
from rnet import LookupIpStrategy, TlsVersion, Version, Method, SocketAddr, StatusCode
|
|
15
|
-
from rnet.header import HeaderMap
|
|
16
|
-
from rnet.cookie import Cookie
|
|
17
|
-
from rnet.impersonate import ImpersonateOption, Impersonate
|
|
18
|
-
|
|
19
|
-
class BlockingClient:
|
|
20
|
-
r"""
|
|
21
|
-
A blocking client for making HTTP requests.
|
|
22
|
-
"""
|
|
23
|
-
|
|
24
|
-
user_agent: Optional[str]
|
|
25
|
-
r"""
|
|
26
|
-
Returns the user agent of the client.
|
|
27
|
-
"""
|
|
28
|
-
headers: HeaderMap
|
|
29
|
-
r"""
|
|
30
|
-
Returns the headers of the client.
|
|
31
|
-
"""
|
|
32
|
-
def __new__(
|
|
33
|
-
cls,
|
|
34
|
-
impersonate: Optional[Union[Impersonate, ImpersonateOption]] = None,
|
|
35
|
-
user_agent: Optional[str] = None,
|
|
36
|
-
default_headers: Optional[Union[Dict[str, str], HeaderMap]] = None,
|
|
37
|
-
headers_order: Optional[List[str]] = None,
|
|
38
|
-
referer: Optional[bool] = None,
|
|
39
|
-
allow_redirects: Optional[bool] = None,
|
|
40
|
-
max_redirects: Optional[int] = None,
|
|
41
|
-
cookie_store: Optional[bool] = None,
|
|
42
|
-
lookup_ip_strategy: Optional[LookupIpStrategy] = None,
|
|
43
|
-
timeout: Optional[int] = None,
|
|
44
|
-
connect_timeout: Optional[int] = None,
|
|
45
|
-
read_timeout: Optional[int] = None,
|
|
46
|
-
no_keepalive: Optional[bool] = None,
|
|
47
|
-
tcp_keepalive: Optional[int] = None,
|
|
48
|
-
tcp_keepalive_interval: Optional[int] = None,
|
|
49
|
-
tcp_keepalive_retries: Optional[int] = None,
|
|
50
|
-
tcp_user_timeout: Optional[int] = None,
|
|
51
|
-
pool_idle_timeout: Optional[int] = None,
|
|
52
|
-
pool_max_idle_per_host: Optional[int] = None,
|
|
53
|
-
pool_max_size: Optional[int] = None,
|
|
54
|
-
http1_only: Optional[bool] = None,
|
|
55
|
-
http2_only: Optional[bool] = None,
|
|
56
|
-
https_only: Optional[bool] = None,
|
|
57
|
-
tcp_nodelay: Optional[bool] = None,
|
|
58
|
-
http2_max_retry_count: Optional[int] = None,
|
|
59
|
-
verify: Optional[Union[bool, Path]] = None,
|
|
60
|
-
tls_info: Optional[bool] = None,
|
|
61
|
-
min_tls_version: Optional[TlsVersion] = None,
|
|
62
|
-
max_tls_version: Optional[TlsVersion] = None,
|
|
63
|
-
no_proxy: Optional[bool] = None,
|
|
64
|
-
proxies: Optional[List[Proxy]] = None,
|
|
65
|
-
local_address: Optional[
|
|
66
|
-
Union[str, ipaddress.IPv4Address, ipaddress.IPv6Address]
|
|
67
|
-
] = None,
|
|
68
|
-
interface: Optional[str] = None,
|
|
69
|
-
gzip: Optional[bool] = None,
|
|
70
|
-
brotli: Optional[bool] = None,
|
|
71
|
-
deflate: Optional[bool] = None,
|
|
72
|
-
zstd: Optional[bool] = None,
|
|
73
|
-
) -> BlockingClient:
|
|
74
|
-
r"""
|
|
75
|
-
Creates a new BlockingClient instance.
|
|
76
|
-
|
|
77
|
-
Args:
|
|
78
|
-
impersonate: Browser fingerprint/impersonation config.
|
|
79
|
-
user_agent: Default User-Agent string.
|
|
80
|
-
default_headers: Default request headers.
|
|
81
|
-
headers_order: Custom header order.
|
|
82
|
-
referer: Automatically set Referer.
|
|
83
|
-
allow_redirects: Allow automatic redirects.
|
|
84
|
-
max_redirects: Maximum number of redirects.
|
|
85
|
-
cookie_store: Enable cookie store.
|
|
86
|
-
lookup_ip_strategy: IP lookup strategy.
|
|
87
|
-
timeout: Total timeout (seconds).
|
|
88
|
-
connect_timeout: Connection timeout (seconds).
|
|
89
|
-
read_timeout: Read timeout (seconds).
|
|
90
|
-
no_keepalive: Disable HTTP keep-alive.
|
|
91
|
-
tcp_keepalive: TCP keepalive time (seconds).
|
|
92
|
-
tcp_keepalive_interval: TCP keepalive interval (seconds).
|
|
93
|
-
tcp_keepalive_retries: TCP keepalive retry count.
|
|
94
|
-
tcp_user_timeout: TCP user timeout (seconds).
|
|
95
|
-
pool_idle_timeout: Connection pool idle timeout (seconds).
|
|
96
|
-
pool_max_idle_per_host: Max idle connections per host.
|
|
97
|
-
pool_max_size: Max total connections in pool.
|
|
98
|
-
http1_only: Enable HTTP/1.1 only.
|
|
99
|
-
http2_only: Enable HTTP/2 only.
|
|
100
|
-
https_only: Enable HTTPS only.
|
|
101
|
-
tcp_nodelay: Enable TCP_NODELAY.
|
|
102
|
-
http2_max_retry_count: Max HTTP/2 retry count.
|
|
103
|
-
verify: Verify SSL or specify CA path.
|
|
104
|
-
tls_info: Return TLS info.
|
|
105
|
-
min_tls_version: Minimum TLS version.
|
|
106
|
-
max_tls_version: Maximum TLS version.
|
|
107
|
-
no_proxy: Disable proxy.
|
|
108
|
-
proxies: Proxy server list.
|
|
109
|
-
local_address: Local bind address.
|
|
110
|
-
interface: Local network interface.
|
|
111
|
-
gzip: Enable gzip decompression.
|
|
112
|
-
brotli: Enable brotli decompression.
|
|
113
|
-
deflate: Enable deflate decompression.
|
|
114
|
-
zstd: Enable zstd decompression.
|
|
115
|
-
|
|
116
|
-
# Examples
|
|
117
|
-
|
|
118
|
-
```python
|
|
119
|
-
import asyncio
|
|
120
|
-
import rnet
|
|
121
|
-
|
|
122
|
-
client = rnet.BlockingClient(
|
|
123
|
-
user_agent="my-app/0.0.1",
|
|
124
|
-
timeout=10,
|
|
125
|
-
)
|
|
126
|
-
response = client.get('https://httpbin.org/get')
|
|
127
|
-
print(response.text())
|
|
128
|
-
```
|
|
129
|
-
"""
|
|
130
|
-
|
|
131
|
-
def get_cookies(self, url: str) -> Optional[bytes]:
|
|
132
|
-
r"""
|
|
133
|
-
Returns the cookies for the given URL.
|
|
134
|
-
|
|
135
|
-
# Arguments
|
|
136
|
-
|
|
137
|
-
* `url` - The URL to get the cookies for.
|
|
138
|
-
"""
|
|
139
|
-
|
|
140
|
-
def set_cookie(self, url: str, cookie: Cookie) -> None:
|
|
141
|
-
r"""
|
|
142
|
-
Sets the cookies for the given URL.
|
|
143
|
-
|
|
144
|
-
# Arguments
|
|
145
|
-
* `url` - The URL to set the cookies for.
|
|
146
|
-
* `cookie` - The cookie to set.
|
|
147
|
-
|
|
148
|
-
# Examples
|
|
149
|
-
|
|
150
|
-
```python
|
|
151
|
-
import rnet
|
|
152
|
-
|
|
153
|
-
client = rnet.Client(cookie_store=True)
|
|
154
|
-
client.set_cookie("https://example.com", rnet.Cookie(name="foo", value="bar"))
|
|
155
|
-
```
|
|
156
|
-
"""
|
|
157
|
-
|
|
158
|
-
def remove_cookie(self, url: str, name: str) -> None:
|
|
159
|
-
r"""
|
|
160
|
-
Removes the cookie with the given name for the given URL.
|
|
161
|
-
|
|
162
|
-
# Arguments
|
|
163
|
-
* `url` - The URL to remove the cookie from.
|
|
164
|
-
* `name` - The name of the cookie to remove.
|
|
165
|
-
|
|
166
|
-
# Examples
|
|
167
|
-
|
|
168
|
-
```python
|
|
169
|
-
import rnet
|
|
170
|
-
|
|
171
|
-
client = rnet.Client(cookie_store=True)
|
|
172
|
-
client.remove_cookie("https://example.com", "foo")
|
|
173
|
-
"""
|
|
174
|
-
|
|
175
|
-
def clear_cookies(self) -> None:
|
|
176
|
-
r"""
|
|
177
|
-
Clears the cookies for the given URL.
|
|
178
|
-
"""
|
|
179
|
-
|
|
180
|
-
def update(
|
|
181
|
-
self,
|
|
182
|
-
impersonate: Optional[Union[Impersonate, ImpersonateOption]] = None,
|
|
183
|
-
headers: Optional[Union[Dict[str, str], HeaderMap]] = None,
|
|
184
|
-
headers_order: Optional[List[str]] = None,
|
|
185
|
-
proxies: Optional[List[Proxy]] = None,
|
|
186
|
-
local_address: Optional[
|
|
187
|
-
Union[ipaddress.IPv4Address, ipaddress.IPv6Address]
|
|
188
|
-
] = None,
|
|
189
|
-
interface: Optional[str] = None,
|
|
190
|
-
) -> None:
|
|
191
|
-
r"""
|
|
192
|
-
Updates the client with the given parameters.
|
|
193
|
-
|
|
194
|
-
# Examples
|
|
195
|
-
|
|
196
|
-
```python
|
|
197
|
-
import rnet
|
|
198
|
-
|
|
199
|
-
client = rnet.BlockingClient()
|
|
200
|
-
client.update(
|
|
201
|
-
impersonate=rnet.Impersonate.Firefox135,
|
|
202
|
-
headers={"X-My-Header": "value"},
|
|
203
|
-
proxies=[rnet.Proxy.all("http://proxy.example.com:8080")],
|
|
204
|
-
)
|
|
205
|
-
```
|
|
206
|
-
"""
|
|
207
|
-
|
|
208
|
-
def request(
|
|
209
|
-
self,
|
|
210
|
-
method: Method,
|
|
211
|
-
url: str,
|
|
212
|
-
**kwargs: Unpack[RequestParams],
|
|
213
|
-
) -> BlockingResponse:
|
|
214
|
-
r"""
|
|
215
|
-
Sends a request with the given method and URL.
|
|
216
|
-
|
|
217
|
-
# Examples
|
|
218
|
-
|
|
219
|
-
```python
|
|
220
|
-
import rnet
|
|
221
|
-
import asyncio
|
|
222
|
-
from rnet import Method
|
|
223
|
-
|
|
224
|
-
async def main():
|
|
225
|
-
client = rnet.BlockingClient()
|
|
226
|
-
response = client.request(Method.GET, "https://httpbin.org/anything")
|
|
227
|
-
print(response.text())
|
|
228
|
-
|
|
229
|
-
asyncio.run(main())
|
|
230
|
-
```
|
|
231
|
-
"""
|
|
232
|
-
|
|
233
|
-
def websocket(
|
|
234
|
-
self, url: str, **kwargs: Unpack[WebSocketParams]
|
|
235
|
-
) -> BlockingWebSocket:
|
|
236
|
-
r"""
|
|
237
|
-
Sends a WebSocket request.
|
|
238
|
-
|
|
239
|
-
# Examples
|
|
240
|
-
|
|
241
|
-
```python
|
|
242
|
-
import rnet
|
|
243
|
-
import asyncio
|
|
244
|
-
|
|
245
|
-
async def main():
|
|
246
|
-
client = rnet.BlockingClient()
|
|
247
|
-
ws = client.websocket("wss://echo.websocket.org")
|
|
248
|
-
ws.send(rnet.Message.from_text("Hello, WebSocket!"))
|
|
249
|
-
message = ws.recv()
|
|
250
|
-
print("Received:", message.data)
|
|
251
|
-
ws.close()
|
|
252
|
-
|
|
253
|
-
asyncio.run(main())
|
|
254
|
-
```
|
|
255
|
-
"""
|
|
256
|
-
|
|
257
|
-
def trace(
|
|
258
|
-
self,
|
|
259
|
-
url: str,
|
|
260
|
-
**kwargs: Unpack[RequestParams],
|
|
261
|
-
) -> BlockingResponse:
|
|
262
|
-
r"""
|
|
263
|
-
Sends a request with the given URL.
|
|
264
|
-
|
|
265
|
-
# Examples
|
|
266
|
-
|
|
267
|
-
```python
|
|
268
|
-
import rnet
|
|
269
|
-
import asyncio
|
|
270
|
-
from rnet import Method
|
|
271
|
-
|
|
272
|
-
async def main():
|
|
273
|
-
client = rnet.BlockingClient()
|
|
274
|
-
response = client.trace("https://httpbin.org/anything")
|
|
275
|
-
print(response.text())
|
|
276
|
-
|
|
277
|
-
asyncio.run(main())
|
|
278
|
-
```
|
|
279
|
-
"""
|
|
280
|
-
|
|
281
|
-
def options(
|
|
282
|
-
self,
|
|
283
|
-
url: str,
|
|
284
|
-
**kwargs: Unpack[RequestParams],
|
|
285
|
-
) -> BlockingResponse:
|
|
286
|
-
r"""
|
|
287
|
-
Sends a request with the given URL.
|
|
288
|
-
|
|
289
|
-
# Examples
|
|
290
|
-
|
|
291
|
-
```python
|
|
292
|
-
import rnet
|
|
293
|
-
import asyncio
|
|
294
|
-
from rnet import Method
|
|
295
|
-
|
|
296
|
-
async def main():
|
|
297
|
-
client = rnet.BlockingClient()
|
|
298
|
-
response = client.options("https://httpbin.org/anything")
|
|
299
|
-
print(response.text())
|
|
300
|
-
|
|
301
|
-
asyncio.run(main())
|
|
302
|
-
```
|
|
303
|
-
"""
|
|
304
|
-
|
|
305
|
-
def head(
|
|
306
|
-
self,
|
|
307
|
-
url: str,
|
|
308
|
-
**kwargs: Unpack[RequestParams],
|
|
309
|
-
) -> BlockingResponse:
|
|
310
|
-
r"""
|
|
311
|
-
Sends a request with the given URL.
|
|
312
|
-
|
|
313
|
-
# Examples
|
|
314
|
-
|
|
315
|
-
```python
|
|
316
|
-
import rnet
|
|
317
|
-
import asyncio
|
|
318
|
-
from rnet import Method
|
|
319
|
-
|
|
320
|
-
async def main():
|
|
321
|
-
client = rnet.BlockingClient()
|
|
322
|
-
response = client.head("https://httpbin.org/anything")
|
|
323
|
-
print(response.text())
|
|
324
|
-
|
|
325
|
-
asyncio.run(main())
|
|
326
|
-
```
|
|
327
|
-
"""
|
|
328
|
-
|
|
329
|
-
def delete(
|
|
330
|
-
self,
|
|
331
|
-
url: str,
|
|
332
|
-
**kwargs: Unpack[RequestParams],
|
|
333
|
-
) -> BlockingResponse:
|
|
334
|
-
r"""
|
|
335
|
-
Sends a request with the given URL.
|
|
336
|
-
|
|
337
|
-
# Examples
|
|
338
|
-
|
|
339
|
-
```python
|
|
340
|
-
import rnet
|
|
341
|
-
import asyncio
|
|
342
|
-
from rnet import Method
|
|
343
|
-
|
|
344
|
-
async def main():
|
|
345
|
-
client = rnet.BlockingClient()
|
|
346
|
-
response = client.delete("https://httpbin.org/anything")
|
|
347
|
-
print(response.text())
|
|
348
|
-
|
|
349
|
-
asyncio.run(main())
|
|
350
|
-
```
|
|
351
|
-
"""
|
|
352
|
-
|
|
353
|
-
def patch(
|
|
354
|
-
self,
|
|
355
|
-
url: str,
|
|
356
|
-
**kwargs: Unpack[RequestParams],
|
|
357
|
-
) -> BlockingResponse:
|
|
358
|
-
r"""
|
|
359
|
-
Sends a request with the given URL.
|
|
360
|
-
|
|
361
|
-
# Examples
|
|
362
|
-
|
|
363
|
-
```python
|
|
364
|
-
import rnet
|
|
365
|
-
import asyncio
|
|
366
|
-
from rnet import Method
|
|
367
|
-
|
|
368
|
-
async def main():
|
|
369
|
-
client = rnet.BlockingClient()
|
|
370
|
-
response = client.patch("https://httpbin.org/anything", json={"key": "value"})
|
|
371
|
-
print(response.text())
|
|
372
|
-
|
|
373
|
-
asyncio.run(main())
|
|
374
|
-
```
|
|
375
|
-
"""
|
|
376
|
-
|
|
377
|
-
def put(
|
|
378
|
-
self,
|
|
379
|
-
url: str,
|
|
380
|
-
**kwargs: Unpack[RequestParams],
|
|
381
|
-
) -> BlockingResponse:
|
|
382
|
-
r"""
|
|
383
|
-
Sends a request with the given URL.
|
|
384
|
-
|
|
385
|
-
# Examples
|
|
386
|
-
|
|
387
|
-
```python
|
|
388
|
-
import rnet
|
|
389
|
-
import asyncio
|
|
390
|
-
from rnet import Method
|
|
391
|
-
|
|
392
|
-
async def main():
|
|
393
|
-
client = rnet.BlockingClient()
|
|
394
|
-
response = client.put("https://httpbin.org/anything", json={"key": "value"})
|
|
395
|
-
print(response.text())
|
|
396
|
-
|
|
397
|
-
asyncio.run(main())
|
|
398
|
-
```
|
|
399
|
-
"""
|
|
400
|
-
|
|
401
|
-
def post(
|
|
402
|
-
self,
|
|
403
|
-
url: str,
|
|
404
|
-
**kwargs: Unpack[RequestParams],
|
|
405
|
-
) -> BlockingResponse:
|
|
406
|
-
r"""
|
|
407
|
-
Sends a request with the given URL.
|
|
408
|
-
|
|
409
|
-
# Examples
|
|
410
|
-
|
|
411
|
-
```python
|
|
412
|
-
import rnet
|
|
413
|
-
import asyncio
|
|
414
|
-
from rnet import Method
|
|
415
|
-
|
|
416
|
-
async def main():
|
|
417
|
-
client = rnet.BlockingClient()
|
|
418
|
-
response = client.post("https://httpbin.org/anything", json={"key": "value"})
|
|
419
|
-
print(response.text())
|
|
420
|
-
|
|
421
|
-
asyncio.run(main())
|
|
422
|
-
```
|
|
423
|
-
"""
|
|
424
|
-
|
|
425
|
-
def get(
|
|
426
|
-
self,
|
|
427
|
-
url: str,
|
|
428
|
-
**kwargs: Unpack[RequestParams],
|
|
429
|
-
) -> BlockingResponse:
|
|
430
|
-
r"""
|
|
431
|
-
Sends a request with the given URL.
|
|
432
|
-
|
|
433
|
-
# Examples
|
|
434
|
-
|
|
435
|
-
```python
|
|
436
|
-
import rnet
|
|
437
|
-
import asyncio
|
|
438
|
-
from rnet import Method
|
|
439
|
-
|
|
440
|
-
async def main():
|
|
441
|
-
client = rnet.BlockingClient()
|
|
442
|
-
response = client.get("https://httpbin.org/anything")
|
|
443
|
-
print(response.text())
|
|
444
|
-
|
|
445
|
-
asyncio.run(main())
|
|
446
|
-
```
|
|
447
|
-
"""
|
|
448
|
-
|
|
449
|
-
class BlockingResponse:
|
|
450
|
-
r"""
|
|
451
|
-
A blocking response from a request.
|
|
452
|
-
"""
|
|
453
|
-
|
|
454
|
-
url: str
|
|
455
|
-
r"""
|
|
456
|
-
Returns the URL of the response.
|
|
457
|
-
"""
|
|
458
|
-
ok: bool
|
|
459
|
-
r"""
|
|
460
|
-
Returns whether the response is successful.
|
|
461
|
-
"""
|
|
462
|
-
status: int
|
|
463
|
-
r"""
|
|
464
|
-
Returns the status code as integer of the response.
|
|
465
|
-
"""
|
|
466
|
-
status_code: StatusCode
|
|
467
|
-
r"""
|
|
468
|
-
Returns the status code of the response.
|
|
469
|
-
"""
|
|
470
|
-
version: Version
|
|
471
|
-
r"""
|
|
472
|
-
Returns the HTTP version of the response.
|
|
473
|
-
"""
|
|
474
|
-
headers: HeaderMap
|
|
475
|
-
r"""
|
|
476
|
-
Returns the headers of the response.
|
|
477
|
-
"""
|
|
478
|
-
cookies: List[Cookie]
|
|
479
|
-
r"""
|
|
480
|
-
Returns the cookies of the response.
|
|
481
|
-
"""
|
|
482
|
-
content_length: int
|
|
483
|
-
r"""
|
|
484
|
-
Returns the content length of the response.
|
|
485
|
-
"""
|
|
486
|
-
remote_addr: Optional[SocketAddr]
|
|
487
|
-
r"""
|
|
488
|
-
Returns the remote address of the response.
|
|
489
|
-
"""
|
|
490
|
-
encoding: str
|
|
491
|
-
r"""
|
|
492
|
-
Encoding to decode with when accessing text.
|
|
493
|
-
"""
|
|
494
|
-
def __enter__(self) -> BlockingResponse: ...
|
|
495
|
-
def __exit__(self, _exc_type: Any, _exc_value: Any, _traceback: Any) -> None: ...
|
|
496
|
-
def peer_certificate(self) -> Optional[bytes]:
|
|
497
|
-
r"""
|
|
498
|
-
Returns the TLS peer certificate of the response.
|
|
499
|
-
"""
|
|
500
|
-
|
|
501
|
-
def text(self) -> str:
|
|
502
|
-
r"""
|
|
503
|
-
Returns the text content of the response.
|
|
504
|
-
"""
|
|
505
|
-
|
|
506
|
-
def text_with_charset(self, encoding: str) -> str:
|
|
507
|
-
r"""
|
|
508
|
-
Returns the text content of the response with a specific charset.
|
|
509
|
-
|
|
510
|
-
# Arguments
|
|
511
|
-
|
|
512
|
-
* `encoding` - The default encoding to use if the charset is not specified.
|
|
513
|
-
"""
|
|
514
|
-
|
|
515
|
-
def json(self) -> Any:
|
|
516
|
-
r"""
|
|
517
|
-
Returns the JSON content of the response.
|
|
518
|
-
"""
|
|
519
|
-
|
|
520
|
-
def bytes(self) -> bytes:
|
|
521
|
-
r"""
|
|
522
|
-
Returns the bytes content of the response.
|
|
523
|
-
"""
|
|
524
|
-
|
|
525
|
-
def stream(self) -> BlockingStreamer:
|
|
526
|
-
r"""
|
|
527
|
-
Convert the response into a `Stream` of `Bytes` from the body.
|
|
528
|
-
"""
|
|
529
|
-
|
|
530
|
-
def close(self) -> None:
|
|
531
|
-
r"""
|
|
532
|
-
Closes the response connection.
|
|
533
|
-
"""
|
|
534
|
-
|
|
535
|
-
class BlockingStreamer:
|
|
536
|
-
r"""
|
|
537
|
-
A blocking byte stream response.
|
|
538
|
-
An asynchronous iterator yielding data chunks from the response stream.
|
|
539
|
-
Used for streaming response content.
|
|
540
|
-
Employed in the `stream` method of the `Response` class.
|
|
541
|
-
Utilized in an asynchronous for loop in Python.
|
|
542
|
-
"""
|
|
543
|
-
|
|
544
|
-
def __iter__(self) -> BlockingStreamer: ...
|
|
545
|
-
def __next__(self) -> Any: ...
|
|
546
|
-
def __enter__(self) -> BlockingStreamer: ...
|
|
547
|
-
def __exit__(self, _exc_type: Any, _exc_value: Any, _traceback: Any) -> None: ...
|
|
548
|
-
|
|
549
|
-
class BlockingWebSocket:
|
|
550
|
-
r"""
|
|
551
|
-
A blocking WebSocket response.
|
|
552
|
-
"""
|
|
553
|
-
|
|
554
|
-
ok: bool
|
|
555
|
-
r"""
|
|
556
|
-
Returns whether the response is successful.
|
|
557
|
-
"""
|
|
558
|
-
status: int
|
|
559
|
-
r"""
|
|
560
|
-
Returns the status code as integer of the response.
|
|
561
|
-
"""
|
|
562
|
-
status_code: StatusCode
|
|
563
|
-
r"""
|
|
564
|
-
Returns the status code of the response.
|
|
565
|
-
"""
|
|
566
|
-
version: Version
|
|
567
|
-
r"""
|
|
568
|
-
Returns the HTTP version of the response.
|
|
569
|
-
"""
|
|
570
|
-
headers: HeaderMap
|
|
571
|
-
r"""
|
|
572
|
-
Returns the headers of the response.
|
|
573
|
-
"""
|
|
574
|
-
cookies: List[Cookie]
|
|
575
|
-
r"""
|
|
576
|
-
Returns the cookies of the response.
|
|
577
|
-
"""
|
|
578
|
-
remote_addr: Optional[SocketAddr]
|
|
579
|
-
r"""
|
|
580
|
-
Returns the remote address of the response.
|
|
581
|
-
"""
|
|
582
|
-
protocol: Optional[str]
|
|
583
|
-
r"""
|
|
584
|
-
Returns the WebSocket protocol.
|
|
585
|
-
"""
|
|
586
|
-
def __iter__(self) -> BlockingWebSocket: ...
|
|
587
|
-
def __next__(self) -> Message: ...
|
|
588
|
-
def __enter__(self) -> BlockingWebSocket: ...
|
|
589
|
-
def __exit__(self, _exc_type: Any, _exc_value: Any, _traceback: Any) -> None: ...
|
|
590
|
-
def recv(self) -> Optional[Message]:
|
|
591
|
-
r"""
|
|
592
|
-
Receives a message from the WebSocket.
|
|
593
|
-
"""
|
|
594
|
-
|
|
595
|
-
def send(self, message: Message) -> None:
|
|
596
|
-
r"""
|
|
597
|
-
Sends a message to the WebSocket.
|
|
598
|
-
|
|
599
|
-
# Arguments
|
|
600
|
-
|
|
601
|
-
* `message` - The message to send.
|
|
602
|
-
"""
|
|
603
|
-
|
|
604
|
-
def close(
|
|
605
|
-
self,
|
|
606
|
-
code: Optional[int] = None,
|
|
607
|
-
reason: Optional[str] = None,
|
|
608
|
-
) -> None:
|
|
609
|
-
r"""
|
|
610
|
-
Closes the WebSocket connection.
|
|
611
|
-
|
|
612
|
-
# Arguments
|
|
613
|
-
|
|
614
|
-
* `code` - An optional close code.
|
|
615
|
-
* `reason` - An optional reason for closing.
|
|
616
|
-
"""
|
rnet/cookie.pyi
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import datetime
|
|
2
|
-
from enum import Enum, auto
|
|
3
|
-
from typing import Optional
|
|
4
|
-
|
|
5
|
-
class SameSite(Enum):
|
|
6
|
-
r"""
|
|
7
|
-
The Cookie SameSite attribute.
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
Strict = auto()
|
|
11
|
-
Lax = auto()
|
|
12
|
-
Empty = auto()
|
|
13
|
-
|
|
14
|
-
class Cookie:
|
|
15
|
-
r"""
|
|
16
|
-
A cookie.
|
|
17
|
-
"""
|
|
18
|
-
|
|
19
|
-
name: str
|
|
20
|
-
r"""
|
|
21
|
-
The name of the cookie.
|
|
22
|
-
"""
|
|
23
|
-
value: str
|
|
24
|
-
r"""
|
|
25
|
-
The value of the cookie.
|
|
26
|
-
"""
|
|
27
|
-
http_only: bool
|
|
28
|
-
r"""
|
|
29
|
-
Returns true if the 'HttpOnly' directive is enabled.
|
|
30
|
-
"""
|
|
31
|
-
secure: bool
|
|
32
|
-
r"""
|
|
33
|
-
Returns true if the 'Secure' directive is enabled.
|
|
34
|
-
"""
|
|
35
|
-
same_site_lax: bool
|
|
36
|
-
r"""
|
|
37
|
-
Returns true if 'SameSite' directive is 'Lax'.
|
|
38
|
-
"""
|
|
39
|
-
same_site_strict: bool
|
|
40
|
-
r"""
|
|
41
|
-
Returns true if 'SameSite' directive is 'Strict'.
|
|
42
|
-
"""
|
|
43
|
-
path: Optional[str]
|
|
44
|
-
r"""
|
|
45
|
-
Returns the path directive of the cookie, if set.
|
|
46
|
-
"""
|
|
47
|
-
domain: Optional[str]
|
|
48
|
-
r"""
|
|
49
|
-
Returns the domain directive of the cookie, if set.
|
|
50
|
-
"""
|
|
51
|
-
max_age: Optional[datetime.timedelta]
|
|
52
|
-
r"""
|
|
53
|
-
Get the Max-Age information.
|
|
54
|
-
"""
|
|
55
|
-
expires: Optional[datetime.datetime]
|
|
56
|
-
r"""
|
|
57
|
-
The cookie expiration time.
|
|
58
|
-
"""
|
|
59
|
-
def __new__(
|
|
60
|
-
cls,
|
|
61
|
-
name: str,
|
|
62
|
-
value: str,
|
|
63
|
-
domain: Optional[str] = None,
|
|
64
|
-
path: Optional[str] = None,
|
|
65
|
-
max_age: Optional[datetime.timedelta] = None,
|
|
66
|
-
expires: Optional[datetime.datetime] = None,
|
|
67
|
-
http_only: bool = False,
|
|
68
|
-
secure: bool = False,
|
|
69
|
-
same_site: Optional[SameSite] = None,
|
|
70
|
-
) -> Cookie:
|
|
71
|
-
r"""
|
|
72
|
-
Create a new cookie.
|
|
73
|
-
"""
|
|
74
|
-
|
|
75
|
-
def __str__(self) -> str: ...
|
|
76
|
-
def __repr__(self) -> str: ...
|