Skip to content

add get_content method to BaseAsset to fetch the asset contents #112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions roblox/bases/baseasset.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

if TYPE_CHECKING:
from ..client import Client
from httpx import Response


class BaseAsset(BaseItem):
Expand Down Expand Up @@ -45,3 +46,19 @@ async def get_resale_data(self) -> AssetResaleData:
)
resale_data = resale_response.json()
return AssetResaleData(data=resale_data)

async def get_content(self) -> Response:
"""
Gets the asset's raw content, usually in rxbm or xml format.
No parsing is performed.

Makes 2 requests: one to get the location, one to fetch from that location

Returns:
The asset's raw content response
"""
return await self._client.requests.get(
url=self._client.url_generator.get_url("assetdelivery", "v1/asset/"),
params={"id": self.id},
follow_redirects=True,
)