Skip to content

Commit

Permalink
Use model_dump() instead of dict() to serialize token credentials
Browse files Browse the repository at this point in the history
- /dinamis_sdk/auth.py
- /dinamis_sdk/__init__.py

See merge request cdos-pub/dinamis-sdk!34
  • Loading branch information
Cresson Remi committed Jan 9, 2025
1 parent a7f31b1 commit 8e19367
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dinamis_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# flake8: noqa
import pkg_resources

__version__ = "0.3.6"
__version__ = "0.3.8"
from dinamis_sdk.s3 import (
sign,
sign_inplace,
Expand Down
2 changes: 1 addition & 1 deletion dinamis_sdk/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def save_token(self, now: datetime.datetime):
try:
if self.jwt:
with open(JWT_FILE, "w", encoding="UTF-8") as file:
json.dump(self.jwt.dict(), file)
json.dump(self.jwt.model_dump(), file)
log.debug("Token saved in %s", JWT_FILE)
except IOError as io_err:
log.warning("Unable to save token (%s)", io_err)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ requires-python = ">=3.7"
dependencies = [
"setuptools>=61.2",
"click>=7.1",
"pydantic>=1.7.3",
"pydantic>=1.7.3, <3.0.0",
"pystac>=1.0.0",
"pystac-client>=0.2.0",
"requests>=2.25.1",
Expand Down
9 changes: 8 additions & 1 deletion tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
import pkg_resources

version_from_module = dinamis_sdk.__version__
version_from_pkg = pkg_resources.require("dinamis-sdk")[0].version
from importlib.metadata import version, PackageNotFoundError

try:
version_from_pkg = version("dinamis_sdk")
except PackageNotFoundError:
# package is not installed
version_from_pkg = ""

assert version_from_module
assert version_from_pkg
assert version_from_module == version_from_pkg, f"version from module is {version_from_module} but version from pkg is {version_from_pkg}"

0 comments on commit 8e19367

Please sign in to comment.