Skip to content

Commit

Permalink
[Data Workflows] More robust path parameter encoding (#2004)
Browse files Browse the repository at this point in the history
  • Loading branch information
VerstraeteBert authored Nov 1, 2024
1 parent 3c739e5 commit c77381d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@ Changes are grouped as follows
- `Fixed` for any bug fixes.
- `Security` in case of vulnerabilities.

## [7.64.4] - 2024-11-01
### Fixed
- Data Workflows: apply more robust path parameter encoding.

## [7.64.3] - 2024-11-01
### Fixed
- Removed superfluous properties from authentication subclass read objects


## [7.64.2] - 2024-10-31
### Fixed
- `HostedExtractor` REST source `authentication` property updated to follow API change.
Expand Down
9 changes: 5 additions & 4 deletions cognite/client/_api/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import warnings
from collections.abc import Iterator, MutableSequence
from typing import TYPE_CHECKING, Any, Literal, TypeAlias, overload
from urllib.parse import quote

from cognite.client._api_client import APIClient
from cognite.client._constants import DEFAULT_LIMIT_READ
Expand All @@ -29,6 +28,7 @@
WorkflowVersionUpsert,
)
from cognite.client.exceptions import CogniteAPIError
from cognite.client.utils._auxiliary import interpolate_and_url_encode
from cognite.client.utils._identifier import (
IdentifierSequence,
WorkflowVersionIdentifierSequence,
Expand Down Expand Up @@ -397,7 +397,8 @@ def run(
body["metadata"] = metadata

response = self._post(
url_path=f"/workflows/{quote(workflow_external_id, '')}/versions/{quote(version, '')}/run", json=body
url_path=interpolate_and_url_encode("/workflows/{}/versions/{}/run", workflow_external_id, version),
json=body,
)
return WorkflowExecution._load(response.json())

Expand Down Expand Up @@ -678,7 +679,7 @@ def retrieve(self, workflow_external_id: str, version: str) -> WorkflowVersion |
"""
try:
response = self._get(
url_path=f"/workflows/{quote(workflow_external_id, '')}/versions/{quote(version, '')}",
url_path=interpolate_and_url_encode("/workflows/{}/versions/{}", workflow_external_id, version)
)
except CogniteAPIError as e:
if e.code == 404:
Expand Down Expand Up @@ -823,7 +824,7 @@ def retrieve(self, external_id: str) -> Workflow | None:
>>> res = client.workflows.retrieve("my workflow")
"""
try:
response = self._get(url_path=f"{self._RESOURCE_PATH}/{quote(external_id, '')}")
response = self._get(url_path=interpolate_and_url_encode("/workflows/{}", external_id))
except CogniteAPIError as e:
if e.code == 404:
return None
Expand Down
2 changes: 1 addition & 1 deletion cognite/client/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import annotations

__version__ = "7.64.3"
__version__ = "7.64.4"
__api_subversion__ = "20230101"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "cognite-sdk"

version = "7.64.3"
version = "7.64.4"
description = "Cognite Python SDK"
readme = "README.md"
documentation = "https://cognite-sdk-python.readthedocs-hosted.com"
Expand Down

0 comments on commit c77381d

Please sign in to comment.