Skip to content

Commit 92d7548

Browse files
author
Clawd
committed
fix(autonomys): fix get_async_download_status endpoint path and add stream_download alias
- Remove incorrect /status suffix from async download status endpoint - Add stream_download() as alias for download_object_stream() for backward compatibility - Clarify that download_id must be UUID, not CID - Update docstrings with correct API endpoint information
1 parent e2c8484 commit 92d7548

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

spoon_toolkits/storage/autonomys_auto_drive/provider.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,11 @@ async def download_object_stream(self, cid: str) -> bytes:
690690
self._log_request("GET", full_url, None, None, None)
691691
raise AutoDriveAPIError(f"Stream download failed: {str(e)}")
692692

693+
# Alias for backward compatibility
694+
async def stream_download(self, cid: str) -> bytes:
695+
"""Alias for download_object_stream for backward compatibility"""
696+
return await self.download_object_stream(cid)
697+
693698
async def download_public_object(self, object_id: str) -> bytes:
694699
"""
695700
GET /api/objects/{id}/public - Download a public object by id (direct download, loads entire file into memory).
@@ -869,19 +874,21 @@ async def create_async_download(self, cid: str) -> Dict[str, Any]:
869874

870875
async def get_async_download_status(self, download_id: str) -> Dict[str, Any]:
871876
"""
872-
GET /api/downloads/async/{download_id}/status - Get async download status
877+
GET /api/downloads/async/{download_id} - Get async download status
873878
874879
Note: This endpoint uses https://public.auto-drive.autonomys.xyz as base URL.
880+
The download_id must be the UUID returned from create_async_download, NOT the CID.
875881
876882
Args:
877-
download_id: The download task ID
883+
download_id: The download task UUID (NOT the CID)
878884
879885
Returns:
880-
Download status including fileSize, downloaded, createdAt, updatedAt
886+
Download status including fileSize, downloadedBytes, status, createdAt, updatedAt
881887
"""
882888
# Async download endpoint uses different base URL (public domain)
883889
download_base_url = "https://public.auto-drive.autonomys.xyz"
884-
endpoint = f"/api/downloads/async/{download_id}/status"
890+
# NOTE: The correct endpoint is /api/downloads/async/{download_id} without /status suffix
891+
endpoint = f"/api/downloads/async/{download_id}"
885892
full_url = f"{download_base_url}{endpoint}"
886893

887894
download_headers = {

0 commit comments

Comments
 (0)