From 29256a24347dda0b1986629af90e97e966ccdd3c Mon Sep 17 00:00:00 2001 From: David Michaels Date: Thu, 22 Aug 2024 07:33:01 -0400 Subject: [PATCH] Added portal_utils.Portal.head method --- dcicutils/portal_utils.py | 4 ++-- pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dcicutils/portal_utils.py b/dcicutils/portal_utils.py index c73d565b6..ce92c9270 100644 --- a/dcicutils/portal_utils.py +++ b/dcicutils/portal_utils.py @@ -280,10 +280,10 @@ def post_metadata(self, object_type: str, data: dict, check_only: bool = False) add_on="check_only=True" if check_only else "") return self.post(f"/{object_type}{'?check_only=True' if check_only else ''}", data).json() - def head(self, url: str, follow: bool = False, raise_exception: bool = False, **kwargs) -> Optional[int]: + def head(self, url: str, follow: bool = True, raise_exception: bool = False, **kwargs) -> Optional[int]: try: response = requests.head(self.url(url), **self._kwargs(**kwargs)) - if response and response.status_code in [301, 302, 303, 307, 308] and (follow is True): + if response and response.status_code in [301, 302, 303, 307, 308] and (follow is not False): response = response.follow() return response.status_code except Exception as e: diff --git a/pyproject.toml b/pyproject.toml index 33e115f58..d418e80e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "dcicutils" -version = "8.14.2.1b1" # TODO: To become 8.14.3 +version = "8.14.2.1b2" # TODO: To become 8.14.3 description = "Utility package for interacting with the 4DN Data Portal and other 4DN resources" authors = ["4DN-DCIC Team "] license = "MIT"