ds_stoa.sign._sign ================== .. py:module:: ds_stoa.sign._sign .. autoapi-nested-parse:: Module for pre-signing URLs for fetching data from GraspDP datalake. This module provides a function to generate pre-signed URLs for securely accessing data stored in the GraspDP datalake. It uses an authentication token and request parameters to request a pre-signed URL from the Stoa service, which can then be used to fetch data without further authentication. The `sign` function supports different environments (development and production) by selecting the appropriate URL to request the pre-signed URL from. Dependencies: - **requests**: For making HTTP requests to the Stoa service. - **os**: For reading environment variables to determine the running environment. - **utils.exceptions**: For enriching exceptions with more context. - **utils.logger**: For logging information and errors. **Example Usage**:: from ds_stoa.sign import sign # Authentication token and parameters for the request token = "your_auth_token" params = {"key": "12345"} # Generate a pre-signed URL pre_signed_url = sign(token=token, params=params) print(pre_signed_url) Attributes ---------- .. autoapisummary:: ds_stoa.sign._sign.LOGGER ds_stoa.sign._sign.BUILDING_MODE Functions --------- .. autoapisummary:: ds_stoa.sign._sign.enrich_http_exception ds_stoa.sign._sign.sign Module Contents --------------- .. py:function:: enrich_http_exception(exc: requests.exceptions.HTTPError) -> None Enriches an HTTP exception with additional context without re-raising it. :param exc: Exception :return: None .. py:data:: LOGGER .. py:data:: BUILDING_MODE .. py:function:: sign(token: str, params: Dict) -> str Generate a pre-signed URL for accessing data in the GraspDP datalake. :param token: Authentication token required for generating the pre-signed URL. :param params: Parameters for the request, typically including identifiers for the data to be accessed. :return: A string containing the pre-signed URL. :raises ValueError: If the pre-signed URL is not found. **Example**:: >>> sign(token=token, params=params) "https://fmdp.io/stoa-dev/sign/12345"