Skip to content

Commit

Permalink
Update device code loader (#1975)
Browse files Browse the repository at this point in the history
  • Loading branch information
doctrino authored Oct 15, 2024
1 parent 855a9ab commit 3c97242
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ Changes are grouped as follows
- `Fixed` for any bug fixes.
- `Security` in case of vulnerabilities.

## [7.63.4] - 2024-10-14
### Fixed
- Using `OAuthDeviceCode.load` now includes the missing parameters `oauth_discovery_url`, `clear_cache`, and `mem_cache_only`.
- All unknown parameters to `OAuthDeviceCode.load` are now passed on as `token_custom_args`.

## [7.63.3] - 2024-10-13
### Fixed
- NodeList and EdgeList (and subclasses) now support using `.get` with an `external_id` as a shortcut over
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.63.3"
__version__ = "7.63.4"
__api_subversion__ = "20230101"
18 changes: 11 additions & 7 deletions cognite/client/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,16 +485,20 @@ def load(cls, config: dict[str, Any] | str) -> OAuthDeviceCode:
>>> credentials = OAuthDeviceCode.load(config)
"""
loaded = load_resource_to_dict(config)
token_cache_path = loaded.get("token_cache_path")
token_cache_path = loaded.pop("token_cache_path", None)
return cls(
authority_url=loaded["authority_url"],
client_id=loaded["client_id"],
scopes=loaded.get("scopes"),
cdf_cluster=loaded.get("cdf_cluster"),
token_cache_path=Path(token_cache_path) if token_cache_path else None,
authority_url=loaded.pop("authority_url"),
client_id=loaded.pop("client_id"),
scopes=loaded.pop("scopes", None),
cdf_cluster=loaded.pop("cdf_cluster", None),
oauth_discovery_url=loaded.pop("oauth_discovery_url", None),
token_cache_path=Path(token_cache_path) if token_cache_path is not None else None,
token_expiry_leeway_seconds=int(
loaded.get("token_expiry_leeway_seconds", _TOKEN_EXPIRY_LEEWAY_SECONDS_DEFAULT)
loaded.pop("token_expiry_leeway_seconds", _TOKEN_EXPIRY_LEEWAY_SECONDS_DEFAULT)
),
clear_cache=loaded.pop("clear_cache", False),
mem_cache_only=loaded.pop("mem_cache_only", False),
**loaded,
)

@classmethod
Expand Down
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.63.3"
version = "7.63.4"
description = "Cognite Python SDK"
readme = "README.md"
documentation = "https://cognite-sdk-python.readthedocs-hosted.com"
Expand Down

0 comments on commit 3c97242

Please sign in to comment.