Skip to content

Commit

Permalink
Added portal_utils.Portal.head method
Browse files Browse the repository at this point in the history
  • Loading branch information
dmichaels-harvard committed Aug 22, 2024
1 parent 2539c5f commit 29256a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions dcicutils/portal_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
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.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 <support@4dnucleome.org>"]
license = "MIT"
Expand Down

0 comments on commit 29256a2

Please sign in to comment.