Skip to content

baseasset

roblox.bases.baseasset

This file contains the BaseAsset object, which represents a Roblox asset ID.

BaseAsset (BaseItem)

Represents a Roblox asset ID.

Attributes:

Name Type Description
_shared ClientSharedObject

The ClientSharedObject.

id int

The asset ID.

Source code in roblox/bases/baseasset.py
class BaseAsset(BaseItem):
    """
    Represents a Roblox asset ID.

    Attributes:
        _shared: The ClientSharedObject.
        id: The asset ID.
    """

    def __init__(self, shared: ClientSharedObject, asset_id: int):
        """
        Arguments:
            shared: The ClientSharedObject.
            asset_id: The asset ID.
        """

        self._shared: ClientSharedObject = shared
        self.id: int = asset_id

    async def get_resale_data(self) -> AssetResaleData:
        """
        Gets the asset's limited resale data.
        The asset must be a limited item for this information to be present.

        Returns:
            The asset's limited resale data.
        """
        resale_response = await self._shared.requests.get(
            url=self._shared.url_generator.get_url("economy", f"v1/assets/{self.id}/resale-data")
        )
        resale_data = resale_response.json()
        return AssetResaleData(data=resale_data)

__init__(self, shared: ClientSharedObject, asset_id: int) special

Parameters:

Name Type Description Default
shared ClientSharedObject

The ClientSharedObject.

required
asset_id int

The asset ID.

required
Source code in roblox/bases/baseasset.py
def __init__(self, shared: ClientSharedObject, asset_id: int):
    """
    Arguments:
        shared: The ClientSharedObject.
        asset_id: The asset ID.
    """

    self._shared: ClientSharedObject = shared
    self.id: int = asset_id

get_resale_data(self) -> AssetResaleData async

Gets the asset's limited resale data. The asset must be a limited item for this information to be present.

Returns:

Type Description
AssetResaleData

The asset's limited resale data.

Source code in roblox/bases/baseasset.py
async def get_resale_data(self) -> AssetResaleData:
    """
    Gets the asset's limited resale data.
    The asset must be a limited item for this information to be present.

    Returns:
        The asset's limited resale data.
    """
    resale_response = await self._shared.requests.get(
        url=self._shared.url_generator.get_url("economy", f"v1/assets/{self.id}/resale-data")
    )
    resale_data = resale_response.json()
    return AssetResaleData(data=resale_data)