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.
@@ -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=item.file_path.read_bytes(),
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, api_version: str | None = None, content_type: str = "application/json", accept: str = "application/json"
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["content-type"] = content_type
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,
@@ -94,6 +94,7 @@ class RequestMessage(HTTPMessage):
94
94
  api_version: str | None = None
95
95
  content_type: str = "application/json"
96
96
  accept: str = "application/json"
97
+ content_length: int | None = None
97
98
 
98
99
  @property
99
100
  def total_attempts(self) -> int:
@@ -12,7 +12,7 @@ jobs:
12
12
  environment: dev
13
13
  name: Deploy
14
14
  container:
15
- image: cognite/toolkit:0.7.24
15
+ image: cognite/toolkit:0.7.25
16
16
  env:
17
17
  CDF_CLUSTER: ${{ vars.CDF_CLUSTER }}
18
18
  CDF_PROJECT: ${{ vars.CDF_PROJECT }}
@@ -10,7 +10,7 @@ jobs:
10
10
  environment: dev
11
11
  name: Deploy Dry Run
12
12
  container:
13
- image: cognite/toolkit:0.7.24
13
+ image: cognite/toolkit:0.7.25
14
14
  env:
15
15
  CDF_CLUSTER: ${{ vars.CDF_CLUSTER }}
16
16
  CDF_PROJECT: ${{ vars.CDF_PROJECT }}
@@ -4,7 +4,7 @@ default_env = "<DEFAULT_ENV_PLACEHOLDER>"
4
4
  [modules]
5
5
  # This is the version of the modules. It should not be changed manually.
6
6
  # It will be updated by the 'cdf modules upgrade' command.
7
- version = "0.7.24"
7
+ version = "0.7.25"
8
8
 
9
9
 
10
10
  [plugins]
@@ -1 +1 @@
1
- __version__ = "0.7.24"
1
+ __version__ = "0.7.25"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cognite_toolkit
3
- Version: 0.7.24
3
+ Version: 0.7.25
4
4
  Summary: Official Cognite Data Fusion tool for project templates and configuration deployment
5
5
  Author: Cognite AS
6
6
  Author-email: Cognite AS <support@cognite.com>
@@ -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=Wo31GekIP2VZAUpUy-f0qW2b4IjkRo7aiTXIZxbHoFo,18965
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=NTRfloXkCiS_rl5Vl1D_hsyTTowMKWDsiIR4oGwTADI,11208
286
- cognite_toolkit/_cdf_tk/utils/http_client/_data_classes.py,sha256=6A4qinERG2MhnmNlYogfi0La4Y7Kk19_Mn4QDmg5QHQ,14779
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=yugWo6uuWJX9gVlSHMvVS-9IAthlXyHj5i2k2O440xI,667
307
- cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=0U25CfB2zOOccC4kUPqkuTcbfkJYFQ5oddFuA-VpyUs,2430
308
- cognite_toolkit/_resources/cdf.toml,sha256=1G2sw1GsY067myKMwK-E4scWbYUXFH8yrOhmnr2kbvA,475
309
- cognite_toolkit/_version.py,sha256=6LhdCdekRyhf1ou0xLzDta4kGS27Isdvy5haWR1XJoc,23
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.24.dist-info/WHEEL,sha256=z-mOpxbJHqy3cq6SvUThBZdaLGFZzdZPtgWLcP2NKjQ,79
314
- cognite_toolkit-0.7.24.dist-info/entry_points.txt,sha256=EtZ17K2mUjh-AY0QNU1CPIB_aDSSOdmtNI_4Fj967mA,84
315
- cognite_toolkit-0.7.24.dist-info/METADATA,sha256=RvKGZ5I6tq7vtQPG5rnnKOgLtmYoYPJ0jT_zCzniLks,4507
316
- cognite_toolkit-0.7.24.dist-info/RECORD,,
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,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: uv 0.9.15
2
+ Generator: uv 0.9.16
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any