Skip to content

Commit

Permalink
Merge pull request #23 from lsst-sqre/tickets/DM-41830
Browse files Browse the repository at this point in the history
[DM-41830] Add in get_datalink_result
  • Loading branch information
cbanek authored Dec 12, 2023
2 parents 543e69a + 02d4427 commit 1586ee8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/lsst/rsp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
)
from .forwarder import Forwarder
from .log import IPythonHandler, forward_lsst_log
from .service import get_datalink_result, get_siav2_service
from .utils import (
format_bytes,
get_access_token,
Expand Down Expand Up @@ -40,10 +41,12 @@
"forward_lsst_log",
"get_access_token",
"get_catalog",
"get_datalink_result",
"get_digest",
"get_node",
"get_pod",
"get_tap_service",
"get_siav2_service",
"get_obstap_service",
"retrieve_query",
"get_hostname",
Expand Down
9 changes: 9 additions & 0 deletions src/lsst/rsp/service.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
from pyvo.dal import SIA2Service
from pyvo.dal.adhoc import DatalinkResults
from pyvo.dal.sia2 import ObsCoreRecord

from .utils import get_pyvo_auth, get_service_url


def get_datalink_result(result: ObsCoreRecord) -> DatalinkResults:
"""Helper function to return the datalink part of the result."""
return DatalinkResults.from_result_url(
result.getdataurl(), session=get_pyvo_auth()
)


def get_siav2_service(label: str) -> SIA2Service:
"""Return a configured SIA2Service object that is ready to use."""
if label != "staff":
Expand Down
2 changes: 1 addition & 1 deletion src/lsst/rsp/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def get_service_url(name: str, env_name: Optional[str] = None) -> str:
return url

fqdn = os.getenv("EXTERNAL_INSTANCE_URL") or ""
path = os.getenv(f"{env_name}_ROUTE") or f"/api/{name}"
path = os.getenv(f"{env_name}_ROUTE") or f"api/{name}"
return f"{fqdn}/{path}"


Expand Down

0 comments on commit 1586ee8

Please sign in to comment.