Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e2ab1c0afb |
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "rbx-upload"
|
name = "rbx-upload"
|
||||||
version = "0.2.4"
|
version = "0.2.6"
|
||||||
description = "Roblox asset upload client"
|
description = "Roblox asset upload client"
|
||||||
requires-python = ">=3.13"
|
requires-python = ">=3.13"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|||||||
@@ -289,18 +289,19 @@ class RobloxClient:
|
|||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json() if response.text else {}
|
return response.json() if response.text else {}
|
||||||
|
|
||||||
async def get_collectible_item_id(self, asset_id: int) -> str | None:
|
async def get_collectible_item_id(self, asset_id: int, max_attempts: int = 10, poll_interval: float = 3.0) -> str:
|
||||||
"""Look up the collectible item ID (UUID) for a given asset ID."""
|
"""Look up the collectible item ID (UUID) for a given asset ID, retrying until available."""
|
||||||
csrf = await self._get_csrf_token()
|
for _ in range(max_attempts):
|
||||||
response = await self._http.post(
|
response = await self._http.get(
|
||||||
self._proxy_url("https://catalog.roblox.com/v1/catalog/items/details"),
|
self._proxy_url(f"https://economy.roblox.com/v2/assets/{asset_id}/details"),
|
||||||
json={"items": [{"itemType": "Asset", "id": asset_id}]},
|
|
||||||
headers={"X-CSRF-TOKEN": csrf},
|
|
||||||
cookies=self._csrf_cookies,
|
cookies=self._csrf_cookies,
|
||||||
)
|
)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
items = response.json().get("data", [])
|
collectible_item_id = response.json().get("CollectibleItemId")
|
||||||
return items[0].get("collectibleItemId") if items else None
|
if collectible_item_id:
|
||||||
|
return collectible_item_id
|
||||||
|
await asyncio.sleep(poll_interval)
|
||||||
|
raise UploadError(f"collectibleItemId not available for asset {asset_id} after {max_attempts} attempts.")
|
||||||
|
|
||||||
async def close(self):
|
async def close(self):
|
||||||
"""Close the underlying HTTP client."""
|
"""Close the underlying HTTP client."""
|
||||||
|
|||||||
Reference in New Issue
Block a user