cognite-toolkit 0.7.24__py3-none-any.whl → 0.7.25__py3-none-any.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.
- cognite_toolkit/_cdf_tk/storageio/_file_content.py +3 -1
- cognite_toolkit/_cdf_tk/utils/http_client/_client.py +12 -6
- cognite_toolkit/_cdf_tk/utils/http_client/_data_classes.py +1 -0
- cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml +1 -1
- cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml +1 -1
- cognite_toolkit/_resources/cdf.toml +1 -1
- cognite_toolkit/_version.py +1 -1
- {cognite_toolkit-0.7.24.dist-info → cognite_toolkit-0.7.25.dist-info}/METADATA +1 -1
- {cognite_toolkit-0.7.24.dist-info → cognite_toolkit-0.7.25.dist-info}/RECORD +11 -11
- {cognite_toolkit-0.7.24.dist-info → cognite_toolkit-0.7.25.dist-info}/WHEEL +1 -1
- {cognite_toolkit-0.7.24.dist-info → cognite_toolkit-0.7.25.dist-info}/entry_points.txt +0 -0
|
@@ -271,12 +271,14 @@ class FileContentIO(UploadableStorageIO[FileContentSelector, MetadataWithFilePat
|
|
|
271
271
|
if not (upload_url := upload_url_getter(item, http_client, results)):
|
|
272
272
|
continue
|
|
273
273
|
|
|
274
|
+
content_bytes = item.file_path.read_bytes()
|
|
274
275
|
upload_response = http_client.request_with_retries(
|
|
275
276
|
message=DataBodyRequest(
|
|
276
277
|
endpoint_url=upload_url,
|
|
277
278
|
method="PUT",
|
|
278
279
|
content_type=item.mime_type,
|
|
279
|
-
data_content=
|
|
280
|
+
data_content=content_bytes,
|
|
281
|
+
content_length=len(content_bytes),
|
|
280
282
|
)
|
|
281
283
|
)
|
|
282
284
|
results.extend(upload_response.as_item_responses(item.as_id()))
|
|
@@ -149,34 +149,40 @@ class HTTPClient:
|
|
|
149
149
|
)
|
|
150
150
|
|
|
151
151
|
def _create_headers(
|
|
152
|
-
self,
|
|
152
|
+
self,
|
|
153
|
+
api_version: str | None = None,
|
|
154
|
+
content_type: str = "application/json",
|
|
155
|
+
accept: str = "application/json",
|
|
156
|
+
content_length: int | None = None,
|
|
153
157
|
) -> MutableMapping[str, str]:
|
|
154
158
|
headers: MutableMapping[str, str] = {}
|
|
155
159
|
headers["User-Agent"] = f"httpx/{httpx.__version__} {get_user_agent()}"
|
|
156
160
|
auth_name, auth_value = self.config.credentials.authorization_header()
|
|
157
161
|
headers[auth_name] = auth_value
|
|
158
|
-
headers["
|
|
162
|
+
headers["Content-Type"] = content_type
|
|
163
|
+
if content_length is not None:
|
|
164
|
+
headers["Content-Length"] = str(content_length)
|
|
159
165
|
headers["accept"] = accept
|
|
160
166
|
headers["x-cdp-sdk"] = f"CogniteToolkit:{get_current_toolkit_version()}"
|
|
161
167
|
headers["x-cdp-app"] = self.config.client_name
|
|
162
168
|
headers["cdf-version"] = api_version or self.config.api_subversion
|
|
163
|
-
if not global_config.disable_gzip:
|
|
169
|
+
if not global_config.disable_gzip and content_length is None:
|
|
164
170
|
headers["Content-Encoding"] = "gzip"
|
|
165
171
|
return headers
|
|
166
172
|
|
|
167
173
|
def _make_request(self, item: RequestMessage) -> httpx.Response:
|
|
168
|
-
headers = self._create_headers(item.api_version, item.content_type, item.accept)
|
|
174
|
+
headers = self._create_headers(item.api_version, item.content_type, item.accept, item.content_length)
|
|
169
175
|
params: dict[str, PrimitiveType] | None = None
|
|
170
176
|
if isinstance(item, ParamRequest):
|
|
171
177
|
params = item.parameters
|
|
172
178
|
data: str | bytes | None = None
|
|
173
179
|
if isinstance(item, BodyRequest):
|
|
174
180
|
data = item.data()
|
|
175
|
-
if not global_config.disable_gzip:
|
|
181
|
+
if not global_config.disable_gzip and item.content_length is None:
|
|
176
182
|
data = gzip.compress(data.encode("utf-8"))
|
|
177
183
|
elif isinstance(item, DataBodyRequest):
|
|
178
184
|
data = item.data()
|
|
179
|
-
if not global_config.disable_gzip:
|
|
185
|
+
if not global_config.disable_gzip and item.content_length is None:
|
|
180
186
|
data = gzip.compress(data)
|
|
181
187
|
return self.session.request(
|
|
182
188
|
method=item.method,
|
cognite_toolkit/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.7.
|
|
1
|
+
__version__ = "0.7.25"
|
|
@@ -245,7 +245,7 @@ cognite_toolkit/_cdf_tk/storageio/_asset_centric.py,sha256=TirKLSNPoLqKjczsw0djW
|
|
|
245
245
|
cognite_toolkit/_cdf_tk/storageio/_base.py,sha256=ElvqhIEBnhcz0yY1Ds164wVN0_7CFNK-uT0-z7LcR9U,13067
|
|
246
246
|
cognite_toolkit/_cdf_tk/storageio/_data_classes.py,sha256=s3TH04BJ1q7rXndRhEbVMEnoOXjxrGg4n-w9Z5uUL-o,3480
|
|
247
247
|
cognite_toolkit/_cdf_tk/storageio/_datapoints.py,sha256=xE1YgoP98-mJjIeF5536KwChzhVY90KYl-bW5sRVhFQ,20206
|
|
248
|
-
cognite_toolkit/_cdf_tk/storageio/_file_content.py,sha256=
|
|
248
|
+
cognite_toolkit/_cdf_tk/storageio/_file_content.py,sha256=4b1Lr8ZROLZg7MjT7IiCsRhyVAl1KCWtr0fcDtyzk1o,19062
|
|
249
249
|
cognite_toolkit/_cdf_tk/storageio/_instances.py,sha256=t9fNpHnT6kCk8LDoPj3qZXmHpyDbPF5BZ6pI8ziTyFw,10810
|
|
250
250
|
cognite_toolkit/_cdf_tk/storageio/_raw.py,sha256=pgZN5MbqDwMZl9Ow1KouDJUO2Ngga8_b6hwv7H31SVQ,5161
|
|
251
251
|
cognite_toolkit/_cdf_tk/storageio/selectors/__init__.py,sha256=VUK1A76zsu4a25A3oaPUrQEEuRcCpUBK6o8UMMKw7qg,2458
|
|
@@ -282,8 +282,8 @@ cognite_toolkit/_cdf_tk/utils/fileio/_writers.py,sha256=mc23m0kJgl57FUDvwLmS7yR3
|
|
|
282
282
|
cognite_toolkit/_cdf_tk/utils/graphql_parser.py,sha256=2i2wDjg_Uw3hJ-pHtPK8hczIuCj5atrK8HZbgWJB-Pk,11532
|
|
283
283
|
cognite_toolkit/_cdf_tk/utils/hashing.py,sha256=3NyNfljyYNTqAyAFBd6XlyWaj43jRzENxIuPdOY6nqo,2116
|
|
284
284
|
cognite_toolkit/_cdf_tk/utils/http_client/__init__.py,sha256=G8b7Bg4yIet5R4Igh3dS2SntWzE6I0iTGBeNlNsSxkQ,857
|
|
285
|
-
cognite_toolkit/_cdf_tk/utils/http_client/_client.py,sha256=
|
|
286
|
-
cognite_toolkit/_cdf_tk/utils/http_client/_data_classes.py,sha256=
|
|
285
|
+
cognite_toolkit/_cdf_tk/utils/http_client/_client.py,sha256=7B9c5_mwmWlf-_juq8-oVJAnc3iJuQDPgY-8uuhD7wA,11487
|
|
286
|
+
cognite_toolkit/_cdf_tk/utils/http_client/_data_classes.py,sha256=8KEDyRRaOLhwN2eA2vaBAzZ__JDUicUDyir6x_PE5lk,14817
|
|
287
287
|
cognite_toolkit/_cdf_tk/utils/http_client/_exception.py,sha256=fC9oW6BN0HbUe2AkYABMP7Kj0-9dNYXVFBY5RQztq2c,126
|
|
288
288
|
cognite_toolkit/_cdf_tk/utils/http_client/_tracker.py,sha256=EBBnd-JZ7nc_jYNFJokCHN2UZ9sx0McFLZvlceUYYic,1215
|
|
289
289
|
cognite_toolkit/_cdf_tk/utils/interactive_select.py,sha256=dP_ZFHvzQRPQxRt6EzURY3Z3Ld_otJtCz-nGqUNtt1k,35725
|
|
@@ -303,14 +303,14 @@ cognite_toolkit/_repo_files/.gitignore,sha256=ip9kf9tcC5OguF4YF4JFEApnKYw0nG0vPi
|
|
|
303
303
|
cognite_toolkit/_repo_files/AzureDevOps/.devops/README.md,sha256=OLA0D7yCX2tACpzvkA0IfkgQ4_swSd-OlJ1tYcTBpsA,240
|
|
304
304
|
cognite_toolkit/_repo_files/AzureDevOps/.devops/deploy-pipeline.yml,sha256=brULcs8joAeBC_w_aoWjDDUHs3JheLMIR9ajPUK96nc,693
|
|
305
305
|
cognite_toolkit/_repo_files/AzureDevOps/.devops/dry-run-pipeline.yml,sha256=OBFDhFWK1mlT4Dc6mDUE2Es834l8sAlYG50-5RxRtHk,723
|
|
306
|
-
cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=
|
|
307
|
-
cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=
|
|
308
|
-
cognite_toolkit/_resources/cdf.toml,sha256=
|
|
309
|
-
cognite_toolkit/_version.py,sha256=
|
|
306
|
+
cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=AE3C_roD1yRh00t5w3C6W7OLAeQhTGAXMalj68JcV2o,667
|
|
307
|
+
cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=5ivDvAj_lDr5njBvUERlTKQ2JBUzm0mA9ADWcnIPdPo,2430
|
|
308
|
+
cognite_toolkit/_resources/cdf.toml,sha256=mTx8mZuU7-yKdyAz_qHHImkMLrl0UFv8BtQ0Vjnjyps,475
|
|
309
|
+
cognite_toolkit/_version.py,sha256=iKBQaXokAaY4fPUZd7GsPmMNh78mp8Ix8lWv4BxZua4,23
|
|
310
310
|
cognite_toolkit/config.dev.yaml,sha256=M33FiIKdS3XKif-9vXniQ444GTZ-bLXV8aFH86u9iUQ,332
|
|
311
311
|
cognite_toolkit/demo/__init__.py,sha256=-m1JoUiwRhNCL18eJ6t7fZOL7RPfowhCuqhYFtLgrss,72
|
|
312
312
|
cognite_toolkit/demo/_base.py,sha256=6xKBUQpXZXGQ3fJ5f7nj7oT0s2n7OTAGIa17ZlKHZ5U,8052
|
|
313
|
-
cognite_toolkit-0.7.
|
|
314
|
-
cognite_toolkit-0.7.
|
|
315
|
-
cognite_toolkit-0.7.
|
|
316
|
-
cognite_toolkit-0.7.
|
|
313
|
+
cognite_toolkit-0.7.25.dist-info/WHEEL,sha256=93kfTGt3a0Dykt_T-gsjtyS5_p8F_d6CE1NwmBOirzo,79
|
|
314
|
+
cognite_toolkit-0.7.25.dist-info/entry_points.txt,sha256=EtZ17K2mUjh-AY0QNU1CPIB_aDSSOdmtNI_4Fj967mA,84
|
|
315
|
+
cognite_toolkit-0.7.25.dist-info/METADATA,sha256=Xo2lngR5nSAc9EZePQYgLKJCTiWQwWfz5dUvxCD8O_I,4507
|
|
316
|
+
cognite_toolkit-0.7.25.dist-info/RECORD,,
|
|
File without changes
|