Skip to content

API Reference

This API reference describes the Python interface to the ASI-SSDC SED Builder service. The package provides functions to query astronomical sources and convert spectral energy distribution data into various formats.

Note

At present, only internally hosted catalogs are supported. More will come.

Functions

get_data(ra, dec, timeout=30.0)

Queries the SSDC SED Builder API to retrieve Spectral Energy Distribution data for the specified sky coordinates.

Parameters:

Name Type Description Default
ra Annotated[float, Field(ge=0.0, lt=360.0, description='Right ascension in degrees.')]

Right ascension in degrees (0 to 360).

required
dec Annotated[float, Field(ge=-90.0, le=90.0, description='Declination in degrees.')]

Declination in degrees (-90 to 90).

required
timeout Annotated[Union[float, int], Field(gt=0.0, description='Request timeout in seconds.')]

Request timeout in seconds (default: 30.0).

30.0

Returns:

Type Description
GetDataResponse

A response object. Use its methods to recover data in different formats.

Raises:

Type Description
ValidationError

If coordinates are out of valid range.

TimeoutError

If the API request exceeds the timeout.

RuntimeError

If the API request fails for other reasons.

Example
from sedbuilder import get_data

# Get response from SED for astronomical coordinates
response = get_data(ra=194.04625, dec=-5.789167)

# Access data in different formats
table = response.to_astropy()     # Astropy Table
data_dict = response.to_dict()    # Python dictionary
jt = response.to_jetset(z=0.034)  # Jetset table
json_str = response.to_json()     # JSON string
df = response.to_pandas()         # Pandas DataFrame (requires pandas)
Source code in sedbuilder/requests.py
@validate_call
def get_data(
    ra: Annotated[
        float,
        Field(ge=0.0, lt=360.0, description="Right ascension in degrees."),
    ],
    dec: Annotated[
        float,
        Field(ge=-90.0, le=90.0, description="Declination in degrees."),
    ],
    timeout: Annotated[
        Union[float, int],  # TODO: replace with | syntax when we drop python 3.10 support
        Field(gt=0.0, description="Request timeout in seconds."),
    ] = 30.0,
) -> GetDataResponse:
    """Queries the SSDC SED Builder API to retrieve Spectral Energy Distribution
    data for the specified sky coordinates.

    Args:
        ra: Right ascension in degrees (0 to 360).
        dec: Declination in degrees (-90 to 90).
        timeout: Request timeout in seconds (default: 30.0).

    Returns:
        A response object. Use its methods to recover data in different formats.

    Raises:
        ValidationError: If coordinates are out of valid range.
        TimeoutError: If the API request exceeds the timeout.
        RuntimeError: If the API request fails for other reasons.

    Example:
        ```python
        from sedbuilder import get_data

        # Get response from SED for astronomical coordinates
        response = get_data(ra=194.04625, dec=-5.789167)

        # Access data in different formats
        table = response.to_astropy()     # Astropy Table
        data_dict = response.to_dict()    # Python dictionary
        jt = response.to_jetset(z=0.034)  # Jetset table
        json_str = response.to_json()     # JSON string
        df = response.to_pandas()         # Pandas DataFrame (requires pandas)
        ```
    """
    r = _get_and_validate(APIPaths.GET_DATA(ra=ra, dec=dec), timeout)
    return GetDataResponse(**r.json())

get_data_from_json(filepath)

Reads a JSON file containing SED Builder API response data and validates it against get_data response schema.

Parameters:

Name Type Description Default
filepath Annotated[FilePath, Field(description='Path to JSON file.')]

Path to a JSON file containing SED Builder response data. The file must exist and contain valid JSON matching the get_data response schema.

required

Returns:

Type Description
GetDataResponse

Response object with validated SED data.

Raises:

Type Description
ValidationError

If the file does not exist, or if file content does not match the expected response schema.

Source code in sedbuilder/utils.py
@validate_call
def get_data_from_json(
    filepath: Annotated[
        FilePath,
        Field(description="Path to JSON file."),
    ],
) -> GetDataResponse:
    """Reads a JSON file containing SED Builder API response data and validates it
    against `get_data` response schema.

    Args:
        filepath: Path to a JSON file containing SED Builder response data.
                  The file must exist and contain valid JSON matching the `get_data`
                  response schema.

    Returns:
        Response object with validated SED data.

    Raises:
        ValidationError: If the file does not exist, or if file content does not
                         match the expected response schema.
    """
    return GetDataResponse.model_validate_json(Path(filepath).read_text())

catalogs(timeout=30.0)

Queries the SSDC SED Builder API to retrieve the list of available catalogs.

Parameters:

Name Type Description Default
timeout Annotated[Union[float, int], Field(gt=0.0, description='Request timeout in seconds.')]

Request timeout in seconds (default: 30.0).

30.0

Returns:

Type Description
CatalogsResponse

A response object containing catalog information. Use its methods to recover data in different formats.

Raises:

Type Description
TimeoutError

If the API request exceeds the timeout.

RuntimeError

If the API request fails for other reasons.

Example
from sedbuilder import catalogs

# Get list of available catalogs
response = catalogs()

# Access catalog data as a list of dictionaries
catalog_list = response.to_list()
Source code in sedbuilder/requests.py
@validate_call
def catalogs(
    timeout: Annotated[
        Union[float, int],  # TODO: replace with | syntax when we drop python 3.10 support
        Field(gt=0.0, description="Request timeout in seconds."),
    ] = 30.0,
) -> CatalogsResponse:
    """Queries the SSDC SED Builder API to retrieve the list of available catalogs.

    Args:
        timeout: Request timeout in seconds (default: 30.0).

    Returns:
        A response object containing catalog information. Use its methods to recover data in different formats.

    Raises:
        TimeoutError: If the API request exceeds the timeout.
        RuntimeError: If the API request fails for other reasons.

    Example:
        ```python
        from sedbuilder import catalogs

        # Get list of available catalogs
        response = catalogs()

        # Access catalog data as a list of dictionaries
        catalog_list = response.to_list()
        ```
    """
    r = _get_and_validate(APIPaths.CATALOGS(), timeout)
    return CatalogsResponse(**r.json())

catalogs_from_json(filepath)

Reads a JSON file containing SED Builder API catalog data and validates it against catalogs response schema.

Parameters:

Name Type Description Default
filepath Annotated[FilePath, Field(description='Path to JSON file.')]

Path to a JSON file containing SED Builder catalog data. The file must exist and contain valid JSON matching the catalogs response schema.

required

Returns:

Type Description
CatalogsResponse

Response object with validated catalog information.

Raises:

Type Description
ValidationError

If the file does not exist, or if file content does not match the expected response schema.

Source code in sedbuilder/utils.py
@validate_call
def catalogs_from_json(
    filepath: Annotated[
        FilePath,
        Field(description="Path to JSON file."),
    ],
) -> CatalogsResponse:
    """Reads a JSON file containing SED Builder API catalog data and validates it
    against `catalogs` response schema.

    Args:
        filepath: Path to a JSON file containing SED Builder catalog data.
                  The file must exist and contain valid JSON matching the `catalogs`
                  response schema.

    Returns:
        Response object with validated catalog information.

    Raises:
        ValidationError: If the file does not exist, or if file content does not
                         match the expected response schema.
    """
    return CatalogsResponse.model_validate_json(Path(filepath).read_text())

Classes

GetDataResponse

Bases: BaseModel

SED Builder API response to getData endpoint.

To retrieve data you call .to_astropy(), or .to_dict() and other methods.

Attributes:

Name Type Description
ResponseInfo ResponseInfo

Status information about the API response.

Properties Properties

Additional science properties for the queried source.

Datasets list[Dataset]

List of catalog entries with measurements.

Meta Meta

Metadata about the response format and other non-science info.

Source code in sedbuilder/schemas.py
class GetDataResponse(BaseModel):
    """SED Builder API response to `getData` endpoint.

    To retrieve data you call `.to_astropy()`, or `.to_dict()` and other methods.

    Attributes:
        ResponseInfo: Status information about the API response.
        Properties: Additional science properties for the queried source.
        Datasets: List of catalog entries with measurements.
        Meta: Metadata about the response format and other non-science info.
    """

    ResponseInfo: ResponseInfo
    Properties: Properties
    Datasets: list[Dataset]
    Meta: Meta

    def __repr__(self) -> str:
        return f"Response(status={self.ResponseInfo.statusCode!r}, " f"Datasets: [#{len(self.Datasets)} entries])"

    def is_successful(self) -> bool:
        """Check if the API response indicates success.

        Returns:
            True if the response status code is 'OK'.
        """
        return self.ResponseInfo.statusCode == "OK"

    def to_dict(self) -> dict:
        """Converts data to a dictionary.

        Returns:
            A dictionary from the response JSON.
        """
        return self.model_dump()

    def to_json(self) -> str:
        """Converts data to JSON.

        Returns:
            A JSON string.
        """
        return json.dumps(self.model_dump())

    def to_pandas(self) -> Any:
        """Converts data to a pandas DataFrame.

        Requires pandas to be installed. Install with `pip install pandas`.

        Returns:
            A pandas dataframe.

        Raises:
            ImportError: If pandas is not installed.
        """
        try:
            return self.to_astropy().to_pandas()
        except AttributeError:
            raise ImportError("pandas is required for this method. Install it with: pip install pandas")

    def to_astropy(self) -> Table:
        """Convert data to an astropy Table.

        Returns:
            Astropy Table with one row per measurements.
        """
        # the gist of it is to build two different tables and to stack them horizontally.
        # the first table is for data columns, the second for the catalog columns.
        columns_data = [*TABLE_SCHEMA.columns(kind="data")]
        columns_catalog = [*TABLE_SCHEMA.columns(kind="catalog")]

        # first we have to unpack the data
        rows_data, rows_catalog = [], []
        for dataset in self.Datasets:
            catalog_dump = {k: v for k, v in dataset.Catalog.model_dump().items() if k in columns_catalog}
            for source_data in dataset.SourceData:
                rows_data.append(source_data.model_dump())
                rows_catalog.append(catalog_dump)

        # TODO: this is an awful hack around astropy 6, which we need to support over 3.10.
        #  remove when we stop supporting astropy 6.
        #  N! i am unsure on whether we could have catalog info without data. the contrary should not be possible.
        #  N! this said, no data means no science: it seems safe to me to just check for `rows_data`
        if not rows_data:
            columns = columns_data + columns_catalog
            table = Table(
                np.zeros(len(columns)),
                names=[col.name for col in columns],
                dtype=[col.dtype for col in columns],
                units=[col.units for col in columns],
            )[:0]
        else:
            # first, the column table
            table_data = Table(
                rows_data,
                names=[col.name for col in columns_data],
                dtype=[col.dtype for col in columns_data],
                units=[col.units for col in columns_data],
            )

            # second, the catalog property table
            table_catalog = Table(
                rows_catalog,
                names=[col.name for col in columns_catalog],
                dtype=[col.dtype for col in columns_catalog],
                units=[col.units for col in columns_catalog],
            )

            # then, we stack
            table = hstack((table_data, table_catalog))

        # and add metadata
        for m in TABLE_SCHEMA.metadata():
            table.meta[m.name] = getattr(self.Properties, m.name)
            if m.units:
                table.meta[m.name] *= m.units
        return table

    @validate_call
    def to_jetset(
        self,
        z: Annotated[
            float,
            Field(ge=0.0, le=1.0, description="Source redshift, must be between 0 and 1."),
        ],
        ul_cl: Annotated[
            float,
            Field(ge=0.0, le=1.0, description="Confidence level for upper limits, must be between 0 and 1."),
        ] = 0.95,
        restframe: Annotated[
            Literal["obs", "src"],
            Field(description="Reference frame for the data. Defaults to 'obs'."),
        ] = "obs",
        data_scale: Annotated[
            Literal["lin-lin", "log-log"],
            Field(description="Scale format of the data."),
        ] = "lin-lin",
        obj_name: Annotated[
            str,
            Field(description="Name identifier for the object."),
        ] = "new-src",
    ) -> Table:
        # noinspection PyUnresolvedReferences
        """Convert data to Jetset format.

        The output includes both the data table with renamed columns and appropriate units,
        plus metadata needed for Jetset analysis.

        Args:
            z: Source redshift, must be between 0 and 1.
            ul_cl: Confidence level for upper limits, must be between 0 and 1,
                exclusive. Default is 0.95.
            restframe: Reference frame for the data. Options are "obs" for observed flux (default)
                and "src" for source luminosities.
            data_scale: Scale format of the data. Options are  "lin-lin" for linear scale (default),
                and "log-log" for logarithmic scale.
            obj_name: Name identifier for the object. Default is "new-src".

        Returns:
            A table with column names, units and metadata, compatible with `jetset.data_loader.Data`.

        Raises:
            ValueError: If z < 0, ul_cl is not in (0, 1), restframe or data_scale
                have invalid values, obj_name is empty, or required table columns
                are missing.

        Example:
            ```python
            from sedbuilder import get_data
            from jetset.data_loader import Data

            # Get response from SED for astronomical coordinates
            response = get_data(ra=194.04625, dec=-5.789167)
            # Initialize jetset data structure
            jetset_data = Data(response.to_jetset(z=0.034))
            ```
        """

        def info2ul(infos: Column) -> list[bool]:
            """Parses info column and checks where it contains 'Upper Limit' tag.'"""
            return ["Upper Limit" in [i.strip() for i in str(info).split(self.Meta.InfoSeparator)] for info in infos]

        # type and label choice from Jetset documentation, "Data format and SED data".
        # fmt: off
        t = self.to_astropy()
        table = Table()
        table.add_column(t[TABLE_SCHEMA.FREQUENCY.name].astype(np.float64), name="x")
        table.add_column(t[TABLE_SCHEMA.FREQUENCY_ERROR.name].astype(np.float64), name="dx")
        table.add_column(t[TABLE_SCHEMA.NUFNU.name].astype(np.float64), name="y")
        table.add_column(t[TABLE_SCHEMA.NUFNU_ERROR.name].astype(np.float64), name="dy")
        table.add_column(np.nan_to_num(t[TABLE_SCHEMA.START_TIME.name].value, nan=0.0).astype(np.float64), name="T_start")
        table.add_column(np.nan_to_num(t[TABLE_SCHEMA.STOP_TIME.name].value, nan=0.0).astype(np.float64), name="T_stop")
        table.add_column(info2ul(t[TABLE_SCHEMA.INFO.name]), name="UL")
        table.add_column(t[TABLE_SCHEMA.CATALOG_NAME.name].astype(str), name="dataset")
        table.meta["z"] = z
        table.meta["UL_CL"] = ul_cl
        table.meta["restframe"] = restframe
        table.meta["data_scale"] = data_scale
        table.meta["obj_name"] = obj_name
        # fmt: on
        return table

is_successful()

Check if the API response indicates success.

Returns:

Type Description
bool

True if the response status code is 'OK'.

Source code in sedbuilder/schemas.py
def is_successful(self) -> bool:
    """Check if the API response indicates success.

    Returns:
        True if the response status code is 'OK'.
    """
    return self.ResponseInfo.statusCode == "OK"

to_astropy()

Convert data to an astropy Table.

Returns:

Type Description
Table

Astropy Table with one row per measurements.

Source code in sedbuilder/schemas.py
def to_astropy(self) -> Table:
    """Convert data to an astropy Table.

    Returns:
        Astropy Table with one row per measurements.
    """
    # the gist of it is to build two different tables and to stack them horizontally.
    # the first table is for data columns, the second for the catalog columns.
    columns_data = [*TABLE_SCHEMA.columns(kind="data")]
    columns_catalog = [*TABLE_SCHEMA.columns(kind="catalog")]

    # first we have to unpack the data
    rows_data, rows_catalog = [], []
    for dataset in self.Datasets:
        catalog_dump = {k: v for k, v in dataset.Catalog.model_dump().items() if k in columns_catalog}
        for source_data in dataset.SourceData:
            rows_data.append(source_data.model_dump())
            rows_catalog.append(catalog_dump)

    # TODO: this is an awful hack around astropy 6, which we need to support over 3.10.
    #  remove when we stop supporting astropy 6.
    #  N! i am unsure on whether we could have catalog info without data. the contrary should not be possible.
    #  N! this said, no data means no science: it seems safe to me to just check for `rows_data`
    if not rows_data:
        columns = columns_data + columns_catalog
        table = Table(
            np.zeros(len(columns)),
            names=[col.name for col in columns],
            dtype=[col.dtype for col in columns],
            units=[col.units for col in columns],
        )[:0]
    else:
        # first, the column table
        table_data = Table(
            rows_data,
            names=[col.name for col in columns_data],
            dtype=[col.dtype for col in columns_data],
            units=[col.units for col in columns_data],
        )

        # second, the catalog property table
        table_catalog = Table(
            rows_catalog,
            names=[col.name for col in columns_catalog],
            dtype=[col.dtype for col in columns_catalog],
            units=[col.units for col in columns_catalog],
        )

        # then, we stack
        table = hstack((table_data, table_catalog))

    # and add metadata
    for m in TABLE_SCHEMA.metadata():
        table.meta[m.name] = getattr(self.Properties, m.name)
        if m.units:
            table.meta[m.name] *= m.units
    return table

to_dict()

Converts data to a dictionary.

Returns:

Type Description
dict

A dictionary from the response JSON.

Source code in sedbuilder/schemas.py
def to_dict(self) -> dict:
    """Converts data to a dictionary.

    Returns:
        A dictionary from the response JSON.
    """
    return self.model_dump()

to_jetset(z, ul_cl=0.95, restframe='obs', data_scale='lin-lin', obj_name='new-src')

Convert data to Jetset format.

The output includes both the data table with renamed columns and appropriate units, plus metadata needed for Jetset analysis.

Parameters:

Name Type Description Default
z Annotated[float, Field(ge=0.0, le=1.0, description='Source redshift, must be between 0 and 1.')]

Source redshift, must be between 0 and 1.

required
ul_cl Annotated[float, Field(ge=0.0, le=1.0, description='Confidence level for upper limits, must be between 0 and 1.')]

Confidence level for upper limits, must be between 0 and 1, exclusive. Default is 0.95.

0.95
restframe Annotated[Literal['obs', 'src'], Field(description="Reference frame for the data. Defaults to 'obs'.")]

Reference frame for the data. Options are "obs" for observed flux (default) and "src" for source luminosities.

'obs'
data_scale Annotated[Literal['lin-lin', 'log-log'], Field(description='Scale format of the data.')]

Scale format of the data. Options are "lin-lin" for linear scale (default), and "log-log" for logarithmic scale.

'lin-lin'
obj_name Annotated[str, Field(description='Name identifier for the object.')]

Name identifier for the object. Default is "new-src".

'new-src'

Returns:

Type Description
Table

A table with column names, units and metadata, compatible with jetset.data_loader.Data.

Raises:

Type Description
ValueError

If z < 0, ul_cl is not in (0, 1), restframe or data_scale have invalid values, obj_name is empty, or required table columns are missing.

Example
from sedbuilder import get_data
from jetset.data_loader import Data

# Get response from SED for astronomical coordinates
response = get_data(ra=194.04625, dec=-5.789167)
# Initialize jetset data structure
jetset_data = Data(response.to_jetset(z=0.034))
Source code in sedbuilder/schemas.py
@validate_call
def to_jetset(
    self,
    z: Annotated[
        float,
        Field(ge=0.0, le=1.0, description="Source redshift, must be between 0 and 1."),
    ],
    ul_cl: Annotated[
        float,
        Field(ge=0.0, le=1.0, description="Confidence level for upper limits, must be between 0 and 1."),
    ] = 0.95,
    restframe: Annotated[
        Literal["obs", "src"],
        Field(description="Reference frame for the data. Defaults to 'obs'."),
    ] = "obs",
    data_scale: Annotated[
        Literal["lin-lin", "log-log"],
        Field(description="Scale format of the data."),
    ] = "lin-lin",
    obj_name: Annotated[
        str,
        Field(description="Name identifier for the object."),
    ] = "new-src",
) -> Table:
    # noinspection PyUnresolvedReferences
    """Convert data to Jetset format.

    The output includes both the data table with renamed columns and appropriate units,
    plus metadata needed for Jetset analysis.

    Args:
        z: Source redshift, must be between 0 and 1.
        ul_cl: Confidence level for upper limits, must be between 0 and 1,
            exclusive. Default is 0.95.
        restframe: Reference frame for the data. Options are "obs" for observed flux (default)
            and "src" for source luminosities.
        data_scale: Scale format of the data. Options are  "lin-lin" for linear scale (default),
            and "log-log" for logarithmic scale.
        obj_name: Name identifier for the object. Default is "new-src".

    Returns:
        A table with column names, units and metadata, compatible with `jetset.data_loader.Data`.

    Raises:
        ValueError: If z < 0, ul_cl is not in (0, 1), restframe or data_scale
            have invalid values, obj_name is empty, or required table columns
            are missing.

    Example:
        ```python
        from sedbuilder import get_data
        from jetset.data_loader import Data

        # Get response from SED for astronomical coordinates
        response = get_data(ra=194.04625, dec=-5.789167)
        # Initialize jetset data structure
        jetset_data = Data(response.to_jetset(z=0.034))
        ```
    """

    def info2ul(infos: Column) -> list[bool]:
        """Parses info column and checks where it contains 'Upper Limit' tag.'"""
        return ["Upper Limit" in [i.strip() for i in str(info).split(self.Meta.InfoSeparator)] for info in infos]

    # type and label choice from Jetset documentation, "Data format and SED data".
    # fmt: off
    t = self.to_astropy()
    table = Table()
    table.add_column(t[TABLE_SCHEMA.FREQUENCY.name].astype(np.float64), name="x")
    table.add_column(t[TABLE_SCHEMA.FREQUENCY_ERROR.name].astype(np.float64), name="dx")
    table.add_column(t[TABLE_SCHEMA.NUFNU.name].astype(np.float64), name="y")
    table.add_column(t[TABLE_SCHEMA.NUFNU_ERROR.name].astype(np.float64), name="dy")
    table.add_column(np.nan_to_num(t[TABLE_SCHEMA.START_TIME.name].value, nan=0.0).astype(np.float64), name="T_start")
    table.add_column(np.nan_to_num(t[TABLE_SCHEMA.STOP_TIME.name].value, nan=0.0).astype(np.float64), name="T_stop")
    table.add_column(info2ul(t[TABLE_SCHEMA.INFO.name]), name="UL")
    table.add_column(t[TABLE_SCHEMA.CATALOG_NAME.name].astype(str), name="dataset")
    table.meta["z"] = z
    table.meta["UL_CL"] = ul_cl
    table.meta["restframe"] = restframe
    table.meta["data_scale"] = data_scale
    table.meta["obj_name"] = obj_name
    # fmt: on
    return table

to_json()

Converts data to JSON.

Returns:

Type Description
str

A JSON string.

Source code in sedbuilder/schemas.py
def to_json(self) -> str:
    """Converts data to JSON.

    Returns:
        A JSON string.
    """
    return json.dumps(self.model_dump())

to_pandas()

Converts data to a pandas DataFrame.

Requires pandas to be installed. Install with pip install pandas.

Returns:

Type Description
Any

A pandas dataframe.

Raises:

Type Description
ImportError

If pandas is not installed.

Source code in sedbuilder/schemas.py
def to_pandas(self) -> Any:
    """Converts data to a pandas DataFrame.

    Requires pandas to be installed. Install with `pip install pandas`.

    Returns:
        A pandas dataframe.

    Raises:
        ImportError: If pandas is not installed.
    """
    try:
        return self.to_astropy().to_pandas()
    except AttributeError:
        raise ImportError("pandas is required for this method. Install it with: pip install pandas")

CatalogsResponse

Bases: BaseModel

SED Builder API response to catalogs endpoint.

Contains information about all available catalogs in the SED Builder system, including their names, identifiers, error radii, and spectral classifications.

Attributes:

Name Type Description
ResponseInfo ResponseInfo

Status information about the API response.

Catalogs list[Catalog]

List of catalog information entries.

Source code in sedbuilder/schemas.py
class CatalogsResponse(BaseModel):
    """SED Builder API response to `catalogs` endpoint.

    Contains information about all available catalogs in the SED Builder system,
    including their names, identifiers, error radii, and spectral classifications.

    Attributes:
        ResponseInfo: Status information about the API response.
        Catalogs: List of catalog information entries.
    """

    ResponseInfo: ResponseInfo
    Catalogs: list[Catalog]

    def is_successful(self) -> bool:
        """Check if the API response indicates success.

        Returns:
            True if the response status code is 'OK'.
        """
        return self.ResponseInfo.statusCode == "OK"

    def to_list(self) -> list[dict]:
        """Converts catalog data to a list of dictionaries.

        Returns:
            A list of dictionaries, one per catalog, containing all catalog metadata.
        """
        return [c.model_dump() for c in self.Catalogs]

is_successful()

Check if the API response indicates success.

Returns:

Type Description
bool

True if the response status code is 'OK'.

Source code in sedbuilder/schemas.py
def is_successful(self) -> bool:
    """Check if the API response indicates success.

    Returns:
        True if the response status code is 'OK'.
    """
    return self.ResponseInfo.statusCode == "OK"

to_list()

Converts catalog data to a list of dictionaries.

Returns:

Type Description
list[dict]

A list of dictionaries, one per catalog, containing all catalog metadata.

Source code in sedbuilder/schemas.py
def to_list(self) -> list[dict]:
    """Converts catalog data to a list of dictionaries.

    Returns:
        A list of dictionaries, one per catalog, containing all catalog metadata.
    """
    return [c.model_dump() for c in self.Catalogs]