Skip to content

Commit

Permalink
fix upload_blob
Browse files Browse the repository at this point in the history
  • Loading branch information
magland committed May 14, 2024
1 parent 3e3e981 commit f3cfb4a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions python/dendro/client/_upload_blob.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import tempfile
from .Project import Project
from ..common._api_request import _client_post_api_request
from pydantic import BaseModel

Expand All @@ -19,37 +18,37 @@ class InitiateBlobUploadResponse(BaseModel):


def upload_text_blob(*,
project: Project,
project_id: str,
text: str
):
with tempfile.TemporaryDirectory() as tmpdirname:
file_name = os.path.join(tmpdirname, 'blob.txt')
with open(file_name, 'w') as f:
f.write(text)
return upload_file_blob(project=project, file_name=file_name)
return upload_file_blob(project_id=project_id, file_name=file_name)


def upload_bytes_blob(*,
project: Project,
project_id: str,
bytes: bytes
):
with tempfile.TemporaryDirectory() as tmpdirname:
file_name = os.path.join(tmpdirname, 'blob.bin')
with open(file_name, 'wb') as f:
f.write(bytes)
return upload_file_blob(project=project, file_name=file_name)
return upload_file_blob(project_id=project_id, file_name=file_name)


def upload_json_blob(*,
project: Project,
project_id: str,
json: dict
):
with tempfile.TemporaryDirectory() as tmpdirname:
file_name = os.path.join(tmpdirname, 'blob.json')
import json as json_lib
with open(file_name, 'w') as f:
json_lib.dump(json, f)
return upload_file_blob(project=project, file_name=file_name)
return upload_file_blob(project_id=project_id, file_name=file_name)


def upload_file_blob(*,
Expand Down
2 changes: 1 addition & 1 deletion python/dendro/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.15
0.2.16

0 comments on commit f3cfb4a

Please sign in to comment.