pyreqwest 0.9.0__cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl → 0.10.1__cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.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.
@@ -5,7 +5,6 @@ from pyreqwest._pyreqwest.client import (
5
5
  BaseClientBuilder,
6
6
  Client,
7
7
  ClientBuilder,
8
- Runtime,
9
8
  SyncClient,
10
9
  SyncClientBuilder,
11
10
  )
@@ -17,5 +16,4 @@ __all__ = [
17
16
  "BaseClient",
18
17
  "Client",
19
18
  "SyncClient",
20
- "Runtime",
21
19
  ]
@@ -103,13 +103,18 @@ class BaseClientBuilder:
103
103
  def base_url(self, url: Url | str) -> Self:
104
104
  """Set a base URL automatically prepended to relative request URLs."""
105
105
 
106
- def runtime(self, runtime: "Runtime") -> Self:
107
- """Use a custom runtime (advanced scenarios). Usually not needed. By default, a global runtime is used."""
106
+ def runtime_multithreaded(self, enable: bool) -> Self:
107
+ """Use multithreaded Tokio runtime for client. Default is single-threaded or as configured globally via
108
+ `pyreqwest.runtime` module.
109
+
110
+ Multithreaded runtime may improve performance for high concurrency workloads with complex requests.
111
+ See also `pyreqwest.runtime` module for configuring global multithreaded runtime behavior.
112
+ """
108
113
 
109
114
  def max_connections(self, max_connections: int | None) -> Self:
110
115
  """Maximum number of inflight requests. None means no limit. Default is None."""
111
116
 
112
- def error_for_status(self, enable: bool) -> Self:
117
+ def error_for_status(self, enable: bool = True) -> Self:
113
118
  """Enable automatic HTTP error raising (4xx/5xx)."""
114
119
 
115
120
  def user_agent(self, value: str) -> Self:
@@ -205,9 +210,6 @@ class BaseClientBuilder:
205
210
  Newline codepoints will be transformed to spaces when parsing.
206
211
  """
207
212
 
208
- def http1(self, enabled: bool) -> Self:
209
- """Enable or disable HTTP/1 support. Default is true."""
210
-
211
213
  def http1_only(self) -> Self:
212
214
  """Only use HTTP/1. This is the default. This is consistent with reqwest opt-in http2 feature.
213
215
 
@@ -223,8 +225,7 @@ class BaseClientBuilder:
223
225
  def http2_prior_knowledge(self) -> Self:
224
226
  """Only use HTTP/2.
225
227
 
226
- Same as `.http1(False).http2(True)`. When enabling, it is recommended to tune "http2_" settings for production
227
- usage based on expected workloads.
228
+ When enabling, it is recommended to tune "http2_" settings for production usage based on expected workloads.
228
229
  """
229
230
 
230
231
  def http2_initial_stream_window_size(self, value: int | None) -> Self:
@@ -348,12 +349,3 @@ class SyncClientBuilder(BaseClientBuilder):
348
349
 
349
350
  def json_handler(self, *, loads: SyncJsonLoads | None = ..., dumps: JsonDumps | None = ...) -> Self:
350
351
  """Override JSON loads / dumps callables for this sync client."""
351
-
352
- class Runtime:
353
- """Tokio runtime instance. Usually not needed, as library global runtime is used by default."""
354
-
355
- def __init__(self) -> None:
356
- """Create a tokio runtime instance. This is an advanced feature."""
357
-
358
- async def close(self) -> None:
359
- """Shutdown runtime resources. Clients using this runtime won't work anymore after closing."""
@@ -1,7 +1,7 @@
1
1
  """Exception classes."""
2
2
 
3
3
  from json import JSONDecodeError as JSONDecodeError_
4
- from typing import Any, Generic, TypedDict, TypeVar
4
+ from typing import Any, TypedDict
5
5
 
6
6
 
7
7
  class Cause(TypedDict):
@@ -19,12 +19,10 @@ class CauseErrorDetails(TypedDict):
19
19
  class StatusErrorDetails(TypedDict):
20
20
  """Details for errors that have an associated HTTP status code."""
21
21
 
22
+ causes: list[Cause] | None
22
23
  status: int
23
24
 
24
25
 
25
- T = TypeVar("T", bound=CauseErrorDetails | StatusErrorDetails)
26
-
27
-
28
26
  class PyreqwestError(Exception):
29
27
  """Base class for all pyreqwest errors."""
30
28
 
@@ -35,41 +33,46 @@ class PyreqwestError(Exception):
35
33
  self.message = message
36
34
 
37
35
 
38
- class DetailedPyreqwestError(PyreqwestError, Generic[T]):
36
+ class DetailedPyreqwestError(PyreqwestError):
39
37
  """Base class for all pyreqwest errors with details.
40
38
 
41
39
  Details may be available in `details`.
42
40
  """
43
41
 
44
- def __init__(self, message: str, details: T) -> None:
42
+ def __init__(self, message: str, details: CauseErrorDetails) -> None:
45
43
  """Internally initialized."""
46
44
  assert isinstance(details, dict)
47
45
  PyreqwestError.__init__(self, message, details)
48
- self.details = details
46
+ self.details: CauseErrorDetails = details
49
47
 
50
48
 
51
- class RequestError(DetailedPyreqwestError[T], Generic[T]):
49
+ class RequestError(DetailedPyreqwestError):
52
50
  """Error while processing a request.
53
51
 
54
52
  Details may be available in `details`.
55
53
  """
56
54
 
57
55
 
58
- class StatusError(RequestError[StatusErrorDetails]):
56
+ class StatusError(RequestError):
59
57
  """Error due to HTTP 4xx or 5xx status code. Raised when `error_for_status` is enabled.
60
58
 
61
59
  The status code is available in `details["status"]`.
62
60
  """
63
61
 
62
+ def __init__(self, message: str, details: StatusErrorDetails) -> None:
63
+ """Internally initialized."""
64
+ RequestError.__init__(self, message, details)
65
+ self.details: StatusErrorDetails = details
66
+
64
67
 
65
- class RedirectError(RequestError[CauseErrorDetails]):
68
+ class RedirectError(RequestError):
66
69
  """Error due to too many redirects. Raised when `max_redirects` is exceeded.
67
70
 
68
71
  Cause details may be available in `details["causes"]`.
69
72
  """
70
73
 
71
74
 
72
- class DecodeError(RequestError[CauseErrorDetails]):
75
+ class DecodeError(RequestError):
73
76
  """Error while decoding the response.
74
77
 
75
78
  Cause details may be available in `details["causes"]`.
@@ -98,7 +101,7 @@ class JSONDecodeError(BodyDecodeError, JSONDecodeError_):
98
101
  BodyDecodeError.__init__(self, message, {"causes": details["causes"]})
99
102
 
100
103
 
101
- class TransportError(RequestError[CauseErrorDetails]):
104
+ class TransportError(RequestError):
102
105
  """Error while processing the transport layer.
103
106
 
104
107
  Cause details may be available in `details["causes"]`.
@@ -170,21 +173,21 @@ class WriteError(NetworkError):
170
173
  """
171
174
 
172
175
 
173
- class ClientClosedError(RequestError[CauseErrorDetails]):
176
+ class ClientClosedError(RequestError):
174
177
  """Error due to user closing the client while request was being processed.
175
178
 
176
179
  Cause details may be available in `details["causes"]`.
177
180
  """
178
181
 
179
182
 
180
- class BuilderError(DetailedPyreqwestError[CauseErrorDetails], ValueError):
183
+ class BuilderError(DetailedPyreqwestError, ValueError):
181
184
  """Error while building a request.
182
185
 
183
186
  Cause details may be available in `details["causes"]`.
184
187
  """
185
188
 
186
189
 
187
- class RequestPanicError(RequestError[CauseErrorDetails]):
190
+ class RequestPanicError(RequestError):
188
191
  """Error due to a panic in the request processing.
189
192
 
190
193
  This indicates a bug in pyreqwest or one of its dependencies.
@@ -123,7 +123,7 @@ class RequestBody:
123
123
  """Copy body (Zero-copied bytes. Stream supplies its own copy)."""
124
124
 
125
125
  class BaseRequestBuilder:
126
- def error_for_status(self, enable: bool) -> Self:
126
+ def error_for_status(self, enable: bool = True) -> Self:
127
127
  """Enable automatic HTTP error raising (4xx/5xx)."""
128
128
 
129
129
  def header(self, name: str, value: str) -> Self:
@@ -101,13 +101,13 @@ class ResponseBuilder:
101
101
  def build_sync(self) -> SyncResponse:
102
102
  """Build synchronous response (disallows async streams)."""
103
103
 
104
- def status(self, value: int) -> Self:
104
+ def status(self, status: int) -> Self:
105
105
  """Set status code."""
106
106
 
107
- def version(self, value: str) -> Self:
107
+ def version(self, version: str) -> Self:
108
108
  """Set HTTP version string."""
109
109
 
110
- def header(self, name: str, value: str) -> Self:
110
+ def header(self, key: str, value: str) -> Self:
111
111
  """Append single header value (multiple allowed)."""
112
112
 
113
113
  def headers(self, headers: HeadersType) -> Self:
@@ -0,0 +1,15 @@
1
+ """Runtime configuration. See Tokio runtime documentation for details about config parameters."""
2
+
3
+ from pyreqwest._pyreqwest.runtime import (
4
+ runtime_blocking_thread_keep_alive,
5
+ runtime_max_blocking_threads,
6
+ runtime_multithreaded_default,
7
+ runtime_worker_threads,
8
+ )
9
+
10
+ __all__ = [
11
+ "runtime_multithreaded_default",
12
+ "runtime_worker_threads",
13
+ "runtime_max_blocking_threads",
14
+ "runtime_blocking_thread_keep_alive",
15
+ ]
@@ -0,0 +1,25 @@
1
+ from datetime import timedelta
2
+
3
+ def runtime_multithreaded_default(enable: bool | None) -> None:
4
+ """Enable to use multithreaded runtime by default. None uses default behavior which is to use single-threaded
5
+ runtime.
6
+ """
7
+
8
+ def runtime_worker_threads(threads: int | None) -> None:
9
+ """Set the number of worker threads for the multithreaded runtime. None uses default Tokio behavior which is the
10
+ number of cores available to the system.
11
+
12
+ Should be configured at startup. Can not be changed after multithreaded runtime has been initialized.
13
+ """
14
+
15
+ def runtime_max_blocking_threads(threads: int | None) -> None:
16
+ """Set the maximum number of blocking threads for the multithreaded runtime. None uses default Tokio behavior.
17
+
18
+ Should be configured at startup. Can not be changed after multithreaded runtime has been initialized.
19
+ """
20
+
21
+ def runtime_blocking_thread_keep_alive(duration: timedelta | None) -> None:
22
+ """Set the keep-alive time for blocking threads in the multithreaded runtime. None uses default Tokio behavior.
23
+
24
+ Should be configured at startup. Can not be changed after multithreaded runtime has been initialized.
25
+ """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyreqwest
3
- Version: 0.9.0
3
+ Version: 0.10.1
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Programming Language :: Python
6
6
  Classifier: Programming Language :: Python :: 3
@@ -1,10 +1,10 @@
1
1
  pyreqwest/__init__.py,sha256=AqtJmAtOEQ6kYGY2_Qzw2f_q5K3Q5PN-TpOmIKaeiEM,86
2
2
  pyreqwest/__init__.pyi,sha256=Y25n44pyE3vp92MiABKrcK3IWRyQ1JG1rZ4Ufqy2nC0,17
3
- pyreqwest/_pyreqwest.cpython-313-s390x-linux-gnu.so,sha256=26I2M0KBoBdmCVkHA0RyIEWTsVchR6TRntHe1849Wwk,8575352
3
+ pyreqwest/_pyreqwest.cpython-313-s390x-linux-gnu.so,sha256=mECHriYGsMklqQKdS1wlmod0ueUW3Ka3yCYYnWDz5cU,8670008
4
4
  pyreqwest/bytes/__init__.py,sha256=uzB8cxWbBizu0kyrdXhmnwWKWdwBcVIv4mgEhCR1LMs,465
5
5
  pyreqwest/bytes/__init__.pyi,sha256=bttN8uCg7K3gW90FBgPP4vbtNrBCOwqX4v7LAK-T1pU,4569
6
- pyreqwest/client/__init__.py,sha256=y6krpfN7sB7IxPvFX1kvhhoJI6Bwh9okmg5Jq1cEv7o,353
7
- pyreqwest/client/__init__.pyi,sha256=LUAQcldr6P0AbVUEVBz2GndoLOEwBv-9lQil57peJBw,15083
6
+ pyreqwest/client/__init__.py,sha256=37hK94Tz4MKvCJiYl9H_ZYVXF0CExX4Om-grcPIC9oY,325
7
+ pyreqwest/client/__init__.pyi,sha256=9QjOlirKKXAPqi49JpL8X0HOcumFXfchabUKlI9Jx5k,14832
8
8
  pyreqwest/client/types.py,sha256=CpfplqBGOyvpZNpwbOqal89dBztZlZTYuX-nM1Qrwrg,1475
9
9
  pyreqwest/compatibility/__init__.py,sha256=yJ4VD9iMzvSpYDjM6kEM-F2A_avMFCkOo1g5bgD2AGU,102
10
10
  pyreqwest/compatibility/httpx/__init__.py,sha256=Gc0jMCgmpSHkqQha_zAzxXjrbRSvS6KUOnHp4Z0UMDc,334
@@ -12,7 +12,7 @@ pyreqwest/compatibility/httpx/_internal.py,sha256=olu1ES7bV8AHUqtEMEmGHlejQCxAS3
12
12
  pyreqwest/compatibility/httpx/transport.py,sha256=2wuhREEvpWvcrCZcNv0mH_7MbuqwCO0_b9j7TMxkee8,6672
13
13
  pyreqwest/cookie/__init__.py,sha256=whcJaTtVHgqH2n_lvGYXYHP7D9BolDU6SvKjuKpewAs,128
14
14
  pyreqwest/cookie/__init__.pyi,sha256=YCOI79evRpc7xmSpY6q1MsQMCHSucGDpLmsk0ZqfXN4,6401
15
- pyreqwest/exceptions/__init__.py,sha256=LWD8I6hFsw0ogHwpobPVcO5tfFRhRg0rPF2Bs64XjuI,5319
15
+ pyreqwest/exceptions/__init__.py,sha256=BiKq0hwV7nqu6f2K0Am_BXC9vvuD8snvWbkRLRFZm4Q,5360
16
16
  pyreqwest/http/__init__.py,sha256=hyzkUQ8bj_xrPfOPYwUx0NpahQFFMWzpm2wKCmBe3ug,318
17
17
  pyreqwest/http/__init__.pyi,sha256=xmG6eD1Uz0Y1nRgPb_zxUMKc57rgxWq58W5nsCRg9V0,13798
18
18
  pyreqwest/logging/__init__.py,sha256=KCmYt3ssr69rMe5u3ywFv2cbMOkj4Nz7qxdaBlu_CNc,125
@@ -36,17 +36,19 @@ pyreqwest/pytest_plugin/internal/plugin.py,sha256=NkneUC5Ui-1ATlrG0q-R4_xdkA_Ou3
36
36
  pyreqwest/pytest_plugin/mock.py,sha256=0eFdaXQB4BsfBg3R5ctOShg5yCEgyLlm1mdI44Rynpo,20995
37
37
  pyreqwest/pytest_plugin/types.py,sha256=QyFxjkth7favATSwt3d8EtUBcVjqcUYQ5BxA617T54g,895
38
38
  pyreqwest/request/__init__.py,sha256=zr4G_-kES2pN2HZ5nhbRbpwtEWooLJDX01KXrlUMET4,604
39
- pyreqwest/request/__init__.pyi,sha256=p-4G27vrdmfZIfbXWcXkIZYqPRESzRwMVjJbfIv8wwY,7861
39
+ pyreqwest/request/__init__.pyi,sha256=eLbFMU9_dSMtfMhaWf79lr1TlFmXl8vRfUOq_v-LejU,7868
40
40
  pyreqwest/response/__init__.py,sha256=40wLYwCOzIALl8qZecVLT-qj14Jf5EYTnW7CPVjIvzQ,357
41
- pyreqwest/response/__init__.pyi,sha256=8hebHvfuWadg4zi0esEMJikTrXE296DlWHbYGGkLNfQ,5737
41
+ pyreqwest/response/__init__.pyi,sha256=gfgXNg4q7GZfYgUesw_zyY4slwvso0bzNY-E8__iFZY,5739
42
+ pyreqwest/runtime/__init__.py,sha256=wdw_AyBkN9a98l3nmzoUhp5Wcfa1BIKB3PpGhAWY_eI,441
43
+ pyreqwest/runtime/__init__.pyi,sha256=ndUeESCWse43tDdg3yQa_7utPzEW4EImCvb5tyUXqs8,1168
42
44
  pyreqwest/simple/__init__.py,sha256=kNB7FA92J7OlFnPMColUkUQjEQq_3GTiNWbE2BmHG7k,52
43
45
  pyreqwest/simple/request/__init__.py,sha256=INoWzPcGE_O15wzfJ1tZwy5j0ua0GUAiPDcqwj1qI7Q,428
44
46
  pyreqwest/simple/request/__init__.pyi,sha256=p9BSuuQh1rJk44xwdJhGV8apGPvdB0qAo2HWwqQYj8E,1227
45
47
  pyreqwest/simple/sync_request/__init__.py,sha256=8Jv0wYehivbmscZvpOPkwHpIqNGEIY4x4hZPB5zv2rU,432
46
48
  pyreqwest/simple/sync_request/__init__.pyi,sha256=heyLHDzLPuePzTeX7DLpc9IyTEEHeZKOSjXis0j6BF8,1259
47
49
  pyreqwest/types.py,sha256=10lGx5uugbo5awMz6nNOcuIsyeG3NIB7DqQHiPbOHLk,643
48
- pyreqwest-0.9.0.dist-info/METADATA,sha256=91fHtfUsldlAzVkpldZmeZ9gigKxYhHK4fiANj9waAI,5850
49
- pyreqwest-0.9.0.dist-info/WHEEL,sha256=PPNd-6yB1l1g40RcYkDa5sht228uTmpdFKdcIBDzpcs,145
50
- pyreqwest-0.9.0.dist-info/entry_points.txt,sha256=x6BM9g8m805tw6VqKvSe_Kgd2qp4Eq3moyIoFnETeoE,61
51
- pyreqwest-0.9.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
52
- pyreqwest-0.9.0.dist-info/RECORD,,
50
+ pyreqwest-0.10.1.dist-info/METADATA,sha256=0gUNNuHUolKXcl0-t3d5UoA3ZIjiDy4_pmUF9CgFq6o,5851
51
+ pyreqwest-0.10.1.dist-info/WHEEL,sha256=YlZHjDUVwPr4ZEOVIlWi3GsEbrB2wYQ6m9e1PsSxG-U,145
52
+ pyreqwest-0.10.1.dist-info/entry_points.txt,sha256=x6BM9g8m805tw6VqKvSe_Kgd2qp4Eq3moyIoFnETeoE,61
53
+ pyreqwest-0.10.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
54
+ pyreqwest-0.10.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: maturin (1.11.4)
2
+ Generator: maturin (1.11.5)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp313-cp313-manylinux_2_17_s390x
5
5
  Tag: cp313-cp313-manylinux2014_s390x