Skip to content

Commit

Permalink
added portal_utils.Portal.get_version method
Browse files Browse the repository at this point in the history
  • Loading branch information
dmichaels-harvard committed Aug 24, 2024
1 parent 60b1838 commit 297df96
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Change Log

* Minor changes to view_portal_object utility script.
* Minor changes to validators hooks in structured_data.
* Added portal_utils.Portal.get_version method.


8.14.3
Expand Down
6 changes: 6 additions & 0 deletions dcicutils/portal_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,12 @@ def head(self, url: str, follow: bool = True, raise_exception: bool = False, **k
def get_health(self) -> OptionalResponse:
return self.get("/health")

def get_version(self) -> Optional[str]:
try:
return self.get_health().json()["project_version"]
except Exception:
return None

def ping(self) -> bool:
try:
return self.get_health().status_code == 200
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "dcicutils"
version = "8.14.3.1b2" # TODO: To become 8.14.4
version = "8.14.3.1b3" # TODO: To become 8.14.4
description = "Utility package for interacting with the 4DN Data Portal and other 4DN resources"
authors = ["4DN-DCIC Team <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 297df96

Please sign in to comment.