Skip to content

baseasset

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

BaseAsset

Bases: BaseItem

Represents a Roblox asset ID.

Attributes:

Name Type Description
id int

The asset ID.

Source code in roblox/bases/baseasset.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
class BaseAsset(BaseItem):
    """
    Represents a Roblox asset ID.

    Attributes:
        id: The asset ID.
    """

    def __init__(self, client: Client, asset_id: int):
        """
        Arguments:
            client: The Client this object belongs to.
            asset_id: The asset ID.
        """

        self._client: Client = client
        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._client.requests.get(
            url=self._client.url_generator.get_url("economy", f"v1/assets/{self.id}/resale-data")
        )
        resale_data = resale_response.json()
        return AssetResaleData(data=resale_data)

__init__(client, asset_id)

Parameters:

Name Type Description Default
client Client

The Client this object belongs to.

required
asset_id int

The asset ID.

required
Source code in roblox/bases/baseasset.py
25
26
27
28
29
30
31
32
33
def __init__(self, client: Client, asset_id: int):
    """
    Arguments:
        client: The Client this object belongs to.
        asset_id: The asset ID.
    """

    self._client: Client = client
    self.id: int = asset_id

get_resale_data() 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
35
36
37
38
39
40
41
42
43
44
45
46
47
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._client.requests.get(
        url=self._client.url_generator.get_url("economy", f"v1/assets/{self.id}/resale-data")
    )
    resale_data = resale_response.json()
    return AssetResaleData(data=resale_data)