Compare commits

...

6 Commits

Author SHA1 Message Date
1e693890ef fix
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2023-08-17 14:13:56 -07:00
755a4fd789 Revert "fixes"
This reverts commit 581c06a943.
2023-08-17 14:02:51 -07:00
581c06a943 fixes
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2023-08-17 14:01:41 -07:00
3ce38b0b26 Delete .DS_Store 2023-08-17 13:36:24 -07:00
d8a3120db3 Delete .DS_Store 2023-08-17 13:35:43 -07:00
968e8bbefd fixes
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2023-08-17 13:34:47 -07:00
8 changed files with 1981 additions and 6 deletions

BIN
.DS_Store vendored

Binary file not shown.

1939
assets/ORIGINALVOXEL-3.obj Normal file

File diff suppressed because it is too large Load Diff

BIN
docs/.DS_Store vendored

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -26,7 +26,7 @@ def sync(
if isinstance(fc, FileConversion) and fc.output != "":
if isinstance(fc.output, str):
b = base64.b64decode(fc.output + "===")
b = base64.urlsafe_b64decode(fc.output.strip("=") + "===")
return (fc, b)
return fc
@ -52,7 +52,7 @@ async def asyncio(
if isinstance(fc, FileConversion) and fc.output != "":
if isinstance(fc.output, str):
b = base64.b64decode(fc.output + "===")
b = base64.urlsafe_b64decode(fc.output.strip("=") + "===")
return (fc, b)
return fc

View File

@ -21,7 +21,7 @@ def sync(
if isinstance(fc, FileConversion) and fc.output != "":
if isinstance(fc.output, str):
b = base64.b64decode(fc.output + "===")
b = base64.urlsafe_b64decode(fc.output.strip("=") + "===")
return (fc, b)
return fc
@ -41,7 +41,7 @@ async def asyncio(
if isinstance(fc, FileConversion) and fc.output != "":
if isinstance(fc.output, str):
b = base64.b64decode(fc.output + "===")
b = base64.urlsafe_b64decode(fc.output.strip("=") + "===")
return (fc, b)
return fc

View File

@ -167,6 +167,42 @@ async def test_file_convert_stl_async():
assert len(b) > 0
@pytest.mark.asyncio
async def test_file_convert_obj_async():
# Create our client.
client = ClientFromEnv()
dir_path = os.path.dirname(os.path.realpath(__file__))
file = open(os.path.join(dir_path, "../assets/ORIGINALVOXEL-3.obj"), "rb")
content = file.read()
file.close()
# Get the fc.
result: Union[
Tuple[FileConversion, bytes], Error, None
] = await create_file_conversion_with_base64_helper.asyncio(
client=client,
body=content,
src_format=FileImportFormat.OBJ,
output_format=FileExportFormat.STL,
)
r: Tuple[FileConversion, bytes] = result # type: ignore
b: bytes = r[1]
fc: FileConversion = r[0]
print(f"FileConversion: {fc}")
assert fc.id is not None
assert fc.status == ApiCallStatus.COMPLETED
print(f"FileConversion: {fc}")
# Make sure the bytes are not empty.
assert len(b) > 0
def test_file_mass():
# Create our client.
client = ClientFromEnv()

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "kittycad"
version = "0.4.7"
version = "0.4.9"
description = "A client library for accessing KittyCAD"
authors = []