add fronted docker
This commit is contained in:
1 parent
5cd5ec5649
commit
a18f7a5c8b
14 files changed
+124
-24
No files matched your search
+10
-3
@@ -68,7 +68,9 @@ async def upload_bytes(data: bytes, path: str, content_type: str | None = None)
|
||||
headers = {"Content-Type": content_type or guess_content_type(path), **BLOB_TYPE_HEADER}
|
||||
response = await get_client().put(upload_url(path), content=data, headers=headers)
|
||||
if response.status_code not in (200, 201):
|
||||
raise RuntimeError(f"blob 업로드 실패 {response.status_code}: {response.text[:300]}")
|
||||
print(f"[blob] 업로드 실패 {response.status_code} {path}: {response.text[:300]}",
|
||||
flush=True)
|
||||
raise RuntimeError(f"blob 업로드 실패 {response.status_code}")
|
||||
return public_url(path)
|
||||
|
||||
|
||||
@@ -78,8 +80,13 @@ async def upload_file(file_path: Path, path: str, content_type: str | None = Non
|
||||
|
||||
|
||||
async def download_bytes(url: str) -> bytes:
|
||||
"""upload_bytes가 돌려준 URL을 그대로 받아 내용을 가져온다."""
|
||||
"""upload_bytes가 돌려준 URL을 그대로 받아 내용을 가져온다.
|
||||
|
||||
예외 메시지에 주소를 넣지 않는다 — 실패는 잡에 기록되어 화면까지 간다.
|
||||
어느 파일이었는지는 로그를 본다.
|
||||
"""
|
||||
response = await get_client().get(with_sas(url))
|
||||
if response.status_code != 200:
|
||||
raise RuntimeError(f"blob 다운로드 실패 {response.status_code}: {url}")
|
||||
print(f"[blob] 다운로드 실패 {response.status_code}: {url}", flush=True)
|
||||
raise RuntimeError(f"blob 다운로드 실패 {response.status_code}")
|
||||
return response.content
|
||||
Reference in new issue
Block a user