gazu 0.10.16__tar.gz → 0.10.17__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gazu-0.10.16 → gazu-0.10.17}/PKG-INFO +1 -1
- gazu-0.10.17/gazu/__version__.py +1 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu/client.py +37 -8
- {gazu-0.10.16 → gazu-0.10.17}/gazu.egg-info/PKG-INFO +1 -1
- {gazu-0.10.16 → gazu-0.10.17}/tests/test_client.py +28 -10
- {gazu-0.10.16 → gazu-0.10.17}/tests/test_files.py +20 -0
- gazu-0.10.16/gazu/__version__.py +0 -1
- {gazu-0.10.16 → gazu-0.10.17}/LICENSE +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/README.rst +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu/__init__.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu/asset.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu/cache.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu/casting.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu/concept.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu/context.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu/edit.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu/encoder.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu/entity.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu/events.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu/exception.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu/files.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu/helpers.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu/person.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu/playlist.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu/project.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu/scene.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu/shot.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu/sorting.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu/sync.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu/task.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu/user.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu.egg-info/SOURCES.txt +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu.egg-info/dependency_links.txt +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu.egg-info/not-zip-safe +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu.egg-info/requires.txt +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/gazu.egg-info/top_level.txt +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/pyproject.toml +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/setup.cfg +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/setup.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/tests/test_asset.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/tests/test_cache.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/tests/test_casting.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/tests/test_concept.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/tests/test_context.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/tests/test_edit.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/tests/test_entity.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/tests/test_helpers.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/tests/test_person.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/tests/test_playlist.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/tests/test_project.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/tests/test_scene.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/tests/test_shot.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/tests/test_sync.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/tests/test_task.py +0 -0
- {gazu-0.10.16 → gazu-0.10.17}/tests/test_user.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.10.17"
|
|
@@ -303,6 +303,32 @@ def delete(path, params=None, client=default_client):
|
|
|
303
303
|
return response.text
|
|
304
304
|
|
|
305
305
|
|
|
306
|
+
def get_message_from_response(
|
|
307
|
+
response, default_message="No additional information"
|
|
308
|
+
):
|
|
309
|
+
"""
|
|
310
|
+
A utility function that handles Zou's inconsistent message keys.
|
|
311
|
+
For a given request, checks if any error messages or regular messages were given and returns their value.
|
|
312
|
+
If no messages are found, returns a default message.
|
|
313
|
+
|
|
314
|
+
Args:
|
|
315
|
+
response: requests.Request - A response to check.
|
|
316
|
+
default_message: str - An optional default value to revert to if no message is detected.
|
|
317
|
+
|
|
318
|
+
Returns:
|
|
319
|
+
The message of a given response, or a default message - if any.
|
|
320
|
+
"""
|
|
321
|
+
message = default_message
|
|
322
|
+
message_json = response.json()
|
|
323
|
+
|
|
324
|
+
for key in ["error", "message"]:
|
|
325
|
+
if message_json.get(key):
|
|
326
|
+
message = message_json[key]
|
|
327
|
+
break
|
|
328
|
+
|
|
329
|
+
return message
|
|
330
|
+
|
|
331
|
+
|
|
306
332
|
def check_status(request, path, client=None):
|
|
307
333
|
"""
|
|
308
334
|
Raise an exception related to status code, if the status code does not
|
|
@@ -329,8 +355,7 @@ def check_status(request, path, client=None):
|
|
|
329
355
|
elif status_code == 403:
|
|
330
356
|
raise NotAllowedException(path)
|
|
331
357
|
elif status_code == 400:
|
|
332
|
-
|
|
333
|
-
raise ParameterException(path, text)
|
|
358
|
+
raise ParameterException(path, get_message_from_response(request))
|
|
334
359
|
elif status_code == 405:
|
|
335
360
|
raise MethodNotAllowedException(path)
|
|
336
361
|
elif status_code == 413:
|
|
@@ -359,14 +384,15 @@ def check_status(request, path, client=None):
|
|
|
359
384
|
raise
|
|
360
385
|
elif status_code in [500, 502]:
|
|
361
386
|
try:
|
|
387
|
+
print("A server error occured!\n")
|
|
362
388
|
stacktrace = request.json().get(
|
|
363
389
|
"stacktrace", "No stacktrace sent by the server"
|
|
364
390
|
)
|
|
365
|
-
message = request.json().get(
|
|
366
|
-
"message", "No message sent by the server"
|
|
367
|
-
)
|
|
368
|
-
print("A server error occured!\n")
|
|
369
391
|
print("Server stacktrace:\n%s" % stacktrace)
|
|
392
|
+
message = get_message_from_response(
|
|
393
|
+
response=request,
|
|
394
|
+
default_message="No message sent by the server",
|
|
395
|
+
)
|
|
370
396
|
print("Error message:\n%s\n" % message)
|
|
371
397
|
except Exception:
|
|
372
398
|
print(request.text)
|
|
@@ -474,8 +500,11 @@ def upload(path, file_path, data={}, extra_files=[], client=default_client):
|
|
|
474
500
|
except JSONDecodeError:
|
|
475
501
|
print(response.text)
|
|
476
502
|
raise
|
|
477
|
-
|
|
478
|
-
|
|
503
|
+
|
|
504
|
+
result_message = get_message_from_response(response, default_message="")
|
|
505
|
+
if result_message:
|
|
506
|
+
raise UploadFailedException(result_message)
|
|
507
|
+
|
|
479
508
|
return result
|
|
480
509
|
|
|
481
510
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import datetime
|
|
2
2
|
import json
|
|
3
|
+
import random
|
|
4
|
+
import string
|
|
3
5
|
|
|
4
6
|
import unittest
|
|
5
7
|
import requests_mock
|
|
@@ -281,20 +283,36 @@ class BaseFuncTestCase(ClientTestCase):
|
|
|
281
283
|
"./tests/fixtures/v1.png",
|
|
282
284
|
data={"test": True},
|
|
283
285
|
)
|
|
286
|
+
|
|
287
|
+
error_value = "".join(
|
|
288
|
+
[
|
|
289
|
+
random.choice(
|
|
290
|
+
string.ascii_uppercase + string.ascii_lowercase
|
|
291
|
+
)
|
|
292
|
+
for _ in range(10)
|
|
293
|
+
]
|
|
294
|
+
)
|
|
295
|
+
|
|
284
296
|
with requests_mock.Mocker() as mock:
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
text={"message": "Error"},
|
|
290
|
-
)
|
|
291
|
-
with self.assertRaises(gazu.client.UploadFailedException):
|
|
292
|
-
raw.upload(
|
|
297
|
+
for field in ["message", "error"]:
|
|
298
|
+
mock_route(
|
|
299
|
+
mock,
|
|
300
|
+
"POST",
|
|
293
301
|
"data/new-file",
|
|
294
|
-
|
|
295
|
-
data={"test": True},
|
|
302
|
+
text={field: error_value},
|
|
296
303
|
)
|
|
297
304
|
|
|
305
|
+
with self.assertRaises(
|
|
306
|
+
gazu.client.UploadFailedException
|
|
307
|
+
) as context:
|
|
308
|
+
raw.upload(
|
|
309
|
+
"data/new-file",
|
|
310
|
+
"./tests/fixtures/v1.png",
|
|
311
|
+
data={"test": True},
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
self.assertTrue(str(context.exception) == error_value)
|
|
315
|
+
|
|
298
316
|
def test_upload_multiple_files(self):
|
|
299
317
|
with open("./tests/fixtures/v1.png", "rb") as test_file:
|
|
300
318
|
with requests_mock.Mocker() as mock:
|
|
@@ -39,6 +39,26 @@ class FilesTestCase(unittest.TestCase):
|
|
|
39
39
|
)
|
|
40
40
|
self.assertEqual(working_file["id"], 1)
|
|
41
41
|
|
|
42
|
+
mock.post(
|
|
43
|
+
gazu.client.get_full_url(path),
|
|
44
|
+
text=json.dumps(
|
|
45
|
+
{"error": "The given working file already exists."}
|
|
46
|
+
),
|
|
47
|
+
status_code=400,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
with self.assertRaises(gazu.client.ParameterException) as context:
|
|
51
|
+
gazu.files.new_working_file(
|
|
52
|
+
task,
|
|
53
|
+
person={"id": "person-01"},
|
|
54
|
+
software={"id": "software-1"},
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
self.assertTrue(
|
|
58
|
+
str(context.exception)
|
|
59
|
+
== "The given working file already exists."
|
|
60
|
+
)
|
|
61
|
+
|
|
42
62
|
def test_new_entity_output_file(self):
|
|
43
63
|
entity = {"id": "asset-01"}
|
|
44
64
|
output_type = {"id": "output-type-01"}
|
gazu-0.10.16/gazu/__version__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.10.16"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|