Skip to content

Commit 019ec7d

Browse files
authored
Merge pull request #566 from Labelbox/ms/fix-bulk-upload-mimetypes
add back mime types for bulk uploads
2 parents 3b63841 + 92836a6 commit 019ec7d

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
# Changelog
22

3-
# Version 3.21.0 (in progress)
3+
# Version 3.21.0
44
## Added
55
* Projects can be created with a `media_type`
66
* Added `media_type` attribute to `Project`
77
* New `MediaType` enumeration
88

9+
## Fix
10+
* Added back the mimetype to datarow bulk uploads for orgs that require delegated access
11+
912
# Version 3.20.1 (2022-05-02)
1013
## Updated
1114
* Ontology Classification `scope` field is only set for top level classifications

labelbox/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name = "labelbox"
2-
__version__ = "3.20.1"
2+
__version__ = "3.21.0"
33

44
import sys
55
import warnings
66

77
if sys.version_info < (3, 7):
8-
warnings.warn("""Python 3.6 will no longer be actively supported
8+
warnings.warn("""Python 3.6 will no longer be actively supported
99
starting 06/01/2022. Please upgrade to Python 3.7 or higher.""")
1010

1111
from labelbox.client import Client

labelbox/schema/dataset.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,9 @@ def convert_item(item):
314314
items = [future.result() for future in as_completed(futures)]
315315
# Prepare and upload the desciptor file
316316
data = json.dumps(items)
317-
return self.client.upload_data(data)
317+
return self.client.upload_data(data,
318+
content_type="application/json",
319+
filename="json_import.json")
318320

319321
def data_rows_for_external_id(self,
320322
external_id,

tests/integration/test_dataset.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,19 @@ def test_data_row_export(dataset, image_url):
109109
result = list(dataset.export_data_rows())
110110
assert len(result) == n_data_rows
111111
assert set(result) == ids
112+
113+
114+
def test_create_descriptor_file(dataset):
115+
import unittest.mock as mock
116+
with mock.patch.object(dataset.client,
117+
'upload_data',
118+
wraps=dataset.client.upload_data) as upload_data_spy:
119+
dataset._create_descriptor_file(items=[{'row_data': 'some text...'}])
120+
upload_data_spy.assert_called()
121+
call_args, call_kwargs = upload_data_spy.call_args_list[0][
122+
0], upload_data_spy.call_args_list[0][1]
123+
assert call_args == ('[{"data": "some text..."}]',)
124+
assert call_kwargs == {
125+
'content_type': 'application/json',
126+
'filename': 'json_import.json'
127+
}

0 commit comments

Comments
 (0)