objectstore-client 0.2.3__tar.gz → 0.2.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.
- {objectstore_client-0.2.3 → objectstore_client-0.2.4}/PKG-INFO +1 -1
- {objectstore_client-0.2.3 → objectstore_client-0.2.4}/pyproject.toml +1 -1
- {objectstore_client-0.2.3 → objectstore_client-0.2.4}/src/objectstore_client/client.py +26 -3
- {objectstore_client-0.2.3 → objectstore_client-0.2.4}/LICENSE.md +0 -0
- {objectstore_client-0.2.3 → objectstore_client-0.2.4}/README.md +0 -0
- {objectstore_client-0.2.3 → objectstore_client-0.2.4}/src/objectstore_client/__init__.py +0 -0
- {objectstore_client-0.2.3 → objectstore_client-0.2.4}/src/objectstore_client/auth.py +0 -0
- {objectstore_client-0.2.3 → objectstore_client-0.2.4}/src/objectstore_client/errors.py +0 -0
- {objectstore_client-0.2.3 → objectstore_client-0.2.4}/src/objectstore_client/metadata.py +0 -0
- {objectstore_client-0.2.3 → objectstore_client-0.2.4}/src/objectstore_client/metrics.py +0 -0
- {objectstore_client-0.2.3 → objectstore_client-0.2.4}/src/objectstore_client/multipart.py +0 -0
- {objectstore_client-0.2.3 → objectstore_client-0.2.4}/src/objectstore_client/presign.py +0 -0
- {objectstore_client-0.2.3 → objectstore_client-0.2.4}/src/objectstore_client/py.typed +0 -0
- {objectstore_client-0.2.3 → objectstore_client-0.2.4}/src/objectstore_client/scope.py +0 -0
- {objectstore_client-0.2.3 → objectstore_client-0.2.4}/src/objectstore_client/utils.py +0 -0
|
@@ -5,6 +5,7 @@ import warnings
|
|
|
5
5
|
from collections.abc import Mapping, Sequence
|
|
6
6
|
from dataclasses import asdict, dataclass
|
|
7
7
|
from datetime import UTC, datetime, timedelta
|
|
8
|
+
from importlib.metadata import version
|
|
8
9
|
from io import BytesIO
|
|
9
10
|
from typing import IO, Any, Literal, NamedTuple, cast
|
|
10
11
|
from urllib.parse import urlparse
|
|
@@ -38,6 +39,9 @@ from objectstore_client.scope import Scope
|
|
|
38
39
|
# Query parameter carrying a JWT, mirroring the `x-os-auth` header.
|
|
39
40
|
PARAM_AUTH = "os_auth"
|
|
40
41
|
|
|
42
|
+
# Identifies this library to the server, mirroring the Rust client's user agent.
|
|
43
|
+
USER_AGENT = f"objectstore-client/{version('objectstore-client')}"
|
|
44
|
+
|
|
41
45
|
|
|
42
46
|
class GetResponse(NamedTuple):
|
|
43
47
|
metadata: Metadata
|
|
@@ -100,8 +104,13 @@ class Client:
|
|
|
100
104
|
"http://objectstore:8888"). metrics_backend: Optional metrics backend for
|
|
101
105
|
tracking storage operations. Defaults to ``NoOpMetricsBackend`` if not
|
|
102
106
|
provided.
|
|
103
|
-
propagate_traces:
|
|
104
|
-
|
|
107
|
+
propagate_traces: **Deprecated.** Use Sentry's ``StdlibIntegration``
|
|
108
|
+
instead; it propagates traces on the underlying HTTP request
|
|
109
|
+
regardless of this flag, unless the host application's Sentry SDK
|
|
110
|
+
is configured to opt out.
|
|
111
|
+
|
|
112
|
+
This only controls headers this client adds itself. Defaults to
|
|
113
|
+
``False``.
|
|
105
114
|
retries: Number of connection retries for failed requests.
|
|
106
115
|
Defaults to ``3`` if not specified. **Note:** only connection failures are
|
|
107
116
|
retried, not read failures (as compression streams cannot be rewound).
|
|
@@ -122,7 +131,9 @@ class Client:
|
|
|
122
131
|
|
|
123
132
|
connection_kwargs: Additional keyword arguments to pass to the underlying
|
|
124
133
|
urllib3 connection pool (e.g., custom headers, SSL settings, advanced
|
|
125
|
-
timeouts).
|
|
134
|
+
timeouts). By default, requests carry a ``User-Agent`` header of
|
|
135
|
+
``objectstore-client/{version}``; pass a ``headers`` mapping with a
|
|
136
|
+
``User-Agent`` key here to override it.
|
|
126
137
|
token: A ``SecretKey`` that signs a fresh JWT for each request
|
|
127
138
|
using an EdDSA keypair, or a static pre-signed JWT string used
|
|
128
139
|
as-is for every request. Use a ``SecretKey`` for internal
|
|
@@ -140,6 +151,14 @@ class Client:
|
|
|
140
151
|
connection_kwargs: Mapping[str, Any] | None = None,
|
|
141
152
|
token: TokenProvider | None = None,
|
|
142
153
|
):
|
|
154
|
+
if propagate_traces:
|
|
155
|
+
warnings.warn(
|
|
156
|
+
"`propagate_traces` is deprecated; Sentry's `StdlibIntegration` "
|
|
157
|
+
"already propagates traces on the underlying HTTP request",
|
|
158
|
+
DeprecationWarning,
|
|
159
|
+
stacklevel=2,
|
|
160
|
+
)
|
|
161
|
+
|
|
143
162
|
connection_kwargs_to_use = asdict(_ConnectionDefaults())
|
|
144
163
|
|
|
145
164
|
if retries:
|
|
@@ -158,6 +177,10 @@ class Client:
|
|
|
158
177
|
if connection_kwargs:
|
|
159
178
|
connection_kwargs_to_use = {**connection_kwargs_to_use, **connection_kwargs}
|
|
160
179
|
|
|
180
|
+
headers = urllib3.HTTPHeaderDict({"User-Agent": USER_AGENT})
|
|
181
|
+
headers.update(connection_kwargs_to_use.get("headers") or {})
|
|
182
|
+
connection_kwargs_to_use["headers"] = headers
|
|
183
|
+
|
|
161
184
|
self._pool = urllib3.connectionpool.connection_from_url(
|
|
162
185
|
base_url, **connection_kwargs_to_use
|
|
163
186
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|