Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions src/ga4gh/vrs/dataproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ def __init__(self, base_url: str, disable_healthcheck: bool = False) -> None:
"""Initialize REST-based dataproxy instance.

:param base_url: root URL to server
:param disable_healthcheck: Whether healthcheck should be disabled
"""
super().__init__()
self.base_url = f"{base_url}/{self.rest_version}/"
Expand Down Expand Up @@ -344,16 +345,18 @@ def _isoformat(o: datetime.datetime) -> str:
# self.base_url = base_url


def create_dataproxy(uri: str | None = None) -> _DataProxy:
def create_dataproxy(
uri: str | None = None, disable_healthcheck: bool = False
) -> _DataProxy:
"""Create a dataproxy from uri or GA4GH_VRS_DATAPROXY_URI

Currently accepted URI schemes:

* seqrepo+file:///path/to/seqrepo/root
* seqrepo+:../relative/path/to/seqrepo/root
* seqrepo+http://localhost:5000/seqrepo
* seqrepo+https://somewhere:5000/seqrepo
:param uri: Dataproxy URI. Currently accepted URI schemes:

* seqrepo+file:///path/to/seqrepo/root
* seqrepo+:../relative/path/to/seqrepo/root
* seqrepo+http://localhost:5000/seqrepo
* seqrepo+https://somewhere:5000/seqrepo
:param disable_healthcheck: Whether healthcheck should be disabled in REST dataproxy
:raise ValueError: if URI doesn't match recognized schemes, e.g. is missing provider
prefix (`"seqrepo+"`)
"""
Expand All @@ -379,7 +382,9 @@ def create_dataproxy(uri: str | None = None) -> _DataProxy:
sr = SeqRepo(root_dir=parsed_uri.path)
dp = SeqRepoDataProxy(sr)
elif proto in ("http", "https"):
dp = SeqRepoRESTDataProxy(uri[len(provider) + 1 :])
dp = SeqRepoRESTDataProxy(
uri[len(provider) + 1 :], disable_healthcheck=disable_healthcheck
)
else:
msg = f"SeqRepo URI scheme {parsed_uri.scheme} not implemented"
raise ValueError(msg)
Expand Down
Loading