Skip to content

fetch_custom_curves

fetch_custom_curves

Service for fetch custom curves operations.

Classes

DownloadCustomCurveRunner

Bases: BaseRunner[StringIO]

Runner for downloading a specific custom curve as CSV data. GET /api/v3/scenarios/{scenario_id}/custom_curves/{curve_name}.csv

Functions
run staticmethod
run(client, scenario, curve_name, **kwargs)

Execute the custom curve download operation.

Returns:

Type Description
ServiceResult[Any]

ServiceResult[io.StringIO]: Success case contains StringIO with CSV data; failure case contains error messages.

Source code in src/pyetm/services/scenario_runners/fetch_custom_curves.py
@staticmethod
def run(
    client: BaseClient, scenario: Any, curve_name: str, **kwargs: Any
) -> ServiceResult[Any]:
    """Execute the custom curve download operation.

    Returns:
        ServiceResult[io.StringIO]: Success case contains StringIO with CSV data;
            failure case contains error messages.
    """
    return GenericCurveDownloadRunner.run(client, scenario, curve_name, curve_type="custom")

FetchAllCustomCurveDataRunner

Bases: BaseRunner[Dict[str, Any]]

Runner for fetching metadata for all custom curves on a scenario. GET /api/v3/scenarios/{scenario_id}/custom_curves

Functions
run staticmethod
run(client, scenario, **kwargs)

Execute the fetch all custom curves metadata operation.

Returns:

Type Description
ServiceResult[Dict[str, Any]]

ServiceResult[Dict[str, Any]]: Success case contains dict with curve metadata; failure case contains error messages.

Source code in src/pyetm/services/scenario_runners/fetch_custom_curves.py
@staticmethod
def run(client: BaseClient, scenario: Any, **kwargs: Any) -> ServiceResult[Dict[str, Any]]:
    """Execute the fetch all custom curves metadata operation.

    Returns:
        ServiceResult[Dict[str, Any]]: Success case contains dict with curve metadata;
            failure case contains error messages.
    """
    return FetchAllCustomCurveDataRunner._make_request(
        client=client,
        method="get",
        path=f"/scenarios/{scenario.id}/custom_curves",
        payload={"include_internal": "true"},
    )