There is no function to download raw data from Aleph
hoh opened this issue · comments
Hugo Herter commented
Users should not have to write code such as this themselves:
async def download_data_from_aleph(file_hash) -> bytes:
async with aiohttp.ClientSession(connector=aiohttp.TCPConnector()) as session:
async with session.get(
f"https://aleph.cloud/api/v0/storage/raw/{file_hash}"
) as response:
if response.status != 200:
response_text = await response.text()
raise HTTPException(status_code=response.status, detail=response_text)
return await response.read()
Mike Hukiewitz commented
Is it intended only for this endpoint or for all of them?
Hugo Herter commented
I do not understand your question.
The url prefix /api/v0/storage/raw/{file_hash}
exposes raw data as bytes from a file stored in Aleph builtin storage.
Mike Hukiewitz commented
Fixed by #134