Skip to content

Commit aae0046

Browse files
authored
[PLT-0] Fix exports V2 streamable latin characters support (#1533)
1 parent 54f9ad2 commit aae0046

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

labelbox/schema/export_task.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,10 @@ def _get_file_content(
223223
response = requests.get(file_info.file, timeout=30)
224224
response.raise_for_status()
225225
assert len(
226-
response.text
226+
response.content
227227
) == file_info.offsets.end - file_info.offsets.start + 1, (
228228
f"expected {file_info.offsets.end - file_info.offsets.start + 1} bytes, "
229-
f"got {len(response.text)} bytes")
229+
f"got {len(response.content)} bytes")
230230
return file_info, response.text
231231

232232

@@ -482,6 +482,9 @@ def __str__(self):
482482
"metadata",
483483
"name",
484484
"result",
485+
"result_url",
486+
"errors",
487+
"errors_url",
485488
"status",
486489
"type",
487490
"uid",
@@ -549,6 +552,8 @@ def errors_url(self):
549552
raise ExportTask.ExportTaskException(
550553
"This property is only available for export_v2 tasks due to compatibility reasons, please use streamable errors instead"
551554
)
555+
if not self.has_errors():
556+
return None
552557
base_url = self._task.client.rest_endpoint
553558
return base_url + '/export-errors/' + self._task.uid + '/' + self._task.client.get_organization(
554559
).uid

tests/unit/conftest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ def __init__(self, text: str, exception: Exception = None) -> None:
124124
def text(self):
125125
return self._text
126126

127+
@property
128+
def content(self):
129+
return self._text
130+
127131
def raise_for_status(self):
128132
if self._exception:
129133
raise self._exception

0 commit comments

Comments
 (0)