gazu 0.10.9__tar.gz → 0.10.11__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.9 → gazu-0.10.11}/PKG-INFO +1 -1
- {gazu-0.10.9 → gazu-0.10.11}/gazu/__init__.py +3 -4
- gazu-0.10.11/gazu/__version__.py +1 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu/client.py +93 -39
- {gazu-0.10.9 → gazu-0.10.11}/gazu/shot.py +9 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu.egg-info/PKG-INFO +1 -1
- gazu-0.10.9/gazu/__version__.py +0 -1
- {gazu-0.10.9 → gazu-0.10.11}/LICENSE +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/README.rst +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu/asset.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu/cache.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu/casting.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu/concept.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu/context.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu/edit.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu/encoder.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu/entity.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu/events.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu/exception.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu/files.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu/helpers.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu/person.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu/playlist.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu/project.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu/scene.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu/sorting.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu/sync.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu/task.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu/user.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu.egg-info/SOURCES.txt +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu.egg-info/dependency_links.txt +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu.egg-info/not-zip-safe +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu.egg-info/requires.txt +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/gazu.egg-info/top_level.txt +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/pyproject.toml +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/setup.cfg +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/setup.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/tests/test_asset.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/tests/test_cache.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/tests/test_casting.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/tests/test_client.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/tests/test_concept.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/tests/test_context.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/tests/test_edit.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/tests/test_entity.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/tests/test_files.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/tests/test_helpers.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/tests/test_person.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/tests/test_playlist.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/tests/test_project.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/tests/test_scene.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/tests/test_shot.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/tests/test_sync.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/tests/test_task.py +0 -0
- {gazu-0.10.9 → gazu-0.10.11}/tests/test_user.py +0 -0
|
@@ -120,9 +120,8 @@ def set_token(token, client=raw.default_client):
|
|
|
120
120
|
Args:
|
|
121
121
|
new_tokens (dict): Tokens to use for authentication.
|
|
122
122
|
"""
|
|
123
|
-
|
|
123
|
+
|
|
124
124
|
if isinstance(token, dict):
|
|
125
|
-
|
|
125
|
+
return raw.set_tokens(token, client=client)
|
|
126
126
|
else:
|
|
127
|
-
|
|
128
|
-
return raw.set_tokens(tokens, client=client)
|
|
127
|
+
return raw.set_tokens({"access_token": token}, client=client)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.10.11"
|
|
@@ -20,6 +20,7 @@ from .exception import (
|
|
|
20
20
|
UploadFailedException,
|
|
21
21
|
)
|
|
22
22
|
|
|
23
|
+
|
|
23
24
|
if sys.version_info[0] == 3:
|
|
24
25
|
from json import JSONDecodeError
|
|
25
26
|
else:
|
|
@@ -29,17 +30,38 @@ DEBUG = os.getenv("GAZU_DEBUG", "false").lower() == "true"
|
|
|
29
30
|
|
|
30
31
|
|
|
31
32
|
class KitsuClient(object):
|
|
32
|
-
def __init__(
|
|
33
|
+
def __init__(
|
|
34
|
+
self,
|
|
35
|
+
host,
|
|
36
|
+
ssl_verify=True,
|
|
37
|
+
cert=None,
|
|
38
|
+
automatic_refresh_token=False,
|
|
39
|
+
callback_not_authenticated=None,
|
|
40
|
+
):
|
|
33
41
|
self.tokens = {"access_token": "", "refresh_token": ""}
|
|
34
42
|
self.session = requests.Session()
|
|
35
43
|
self.session.verify = ssl_verify
|
|
36
44
|
self.session.cert = cert
|
|
37
45
|
self.host = host
|
|
38
46
|
self.event_host = host
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
47
|
+
self.automatic_refresh_token = automatic_refresh_token
|
|
48
|
+
self.callback_not_authenticated = callback_not_authenticated
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def create_client(
|
|
52
|
+
host,
|
|
53
|
+
ssl_verify=True,
|
|
54
|
+
cert=None,
|
|
55
|
+
automatic_refresh_token=False,
|
|
56
|
+
callback_not_authenticated=None,
|
|
57
|
+
):
|
|
58
|
+
return KitsuClient(
|
|
59
|
+
host,
|
|
60
|
+
ssl_verify,
|
|
61
|
+
cert=cert,
|
|
62
|
+
automatic_refresh_token=automatic_refresh_token,
|
|
63
|
+
callback_not_authenticated=callback_not_authenticated,
|
|
64
|
+
)
|
|
43
65
|
|
|
44
66
|
|
|
45
67
|
default_client = None
|
|
@@ -199,11 +221,13 @@ def get(path, json_response=True, params=None, client=default_client):
|
|
|
199
221
|
if DEBUG:
|
|
200
222
|
print("GET", get_full_url(path, client))
|
|
201
223
|
path = build_path_with_params(path, params)
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
224
|
+
retry = True
|
|
225
|
+
while retry:
|
|
226
|
+
response = client.session.get(
|
|
227
|
+
get_full_url(path, client=client),
|
|
228
|
+
headers=make_auth_header(client=client),
|
|
229
|
+
)
|
|
230
|
+
_, retry = check_status(response, path, client=client)
|
|
207
231
|
|
|
208
232
|
if json_response:
|
|
209
233
|
return response.json()
|
|
@@ -222,12 +246,14 @@ def post(path, data, client=default_client):
|
|
|
222
246
|
print("POST", get_full_url(path, client))
|
|
223
247
|
if not "password" in data:
|
|
224
248
|
print("Body:", data)
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
249
|
+
retry = True
|
|
250
|
+
while retry:
|
|
251
|
+
response = client.session.post(
|
|
252
|
+
get_full_url(path, client),
|
|
253
|
+
json=data,
|
|
254
|
+
headers=make_auth_header(client=client),
|
|
255
|
+
)
|
|
256
|
+
_, retry = check_status(response, path, client=client)
|
|
231
257
|
try:
|
|
232
258
|
result = response.json()
|
|
233
259
|
except JSONDecodeError:
|
|
@@ -246,12 +272,14 @@ def put(path, data, client=default_client):
|
|
|
246
272
|
if DEBUG:
|
|
247
273
|
print("PUT", get_full_url(path, client))
|
|
248
274
|
print("Body:", data)
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
275
|
+
retry = True
|
|
276
|
+
while retry:
|
|
277
|
+
response = client.session.put(
|
|
278
|
+
get_full_url(path, client),
|
|
279
|
+
json=data,
|
|
280
|
+
headers=make_auth_header(client=client),
|
|
281
|
+
)
|
|
282
|
+
_, retry = check_status(response, path, client=client)
|
|
255
283
|
return response.json()
|
|
256
284
|
|
|
257
285
|
|
|
@@ -266,14 +294,16 @@ def delete(path, params=None, client=default_client):
|
|
|
266
294
|
print("DELETE", get_full_url(path, client))
|
|
267
295
|
path = build_path_with_params(path, params)
|
|
268
296
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
297
|
+
retry = True
|
|
298
|
+
while retry:
|
|
299
|
+
response = client.session.delete(
|
|
300
|
+
get_full_url(path, client), headers=make_auth_header(client=client)
|
|
301
|
+
)
|
|
302
|
+
_, retry = check_status(response, path, client=client)
|
|
273
303
|
return response.text
|
|
274
304
|
|
|
275
305
|
|
|
276
|
-
def check_status(request, path):
|
|
306
|
+
def check_status(request, path, client=None):
|
|
277
307
|
"""
|
|
278
308
|
Raise an exception related to status code, if the status code does not
|
|
279
309
|
match a success code. Print error message when it's relevant.
|
|
@@ -309,7 +339,24 @@ def check_status(request, path):
|
|
|
309
339
|
"Change your proxy configuration to allow bigger files." % path
|
|
310
340
|
)
|
|
311
341
|
elif status_code in [401, 422]:
|
|
312
|
-
|
|
342
|
+
try:
|
|
343
|
+
if client is not None and client.automatic_refresh_token:
|
|
344
|
+
from . import refresh_token
|
|
345
|
+
|
|
346
|
+
refresh_token(client=client)
|
|
347
|
+
|
|
348
|
+
return status_code, True
|
|
349
|
+
else:
|
|
350
|
+
raise NotAuthenticatedException(path)
|
|
351
|
+
except NotAuthenticatedException:
|
|
352
|
+
if (
|
|
353
|
+
client is not None
|
|
354
|
+
and client.callback_not_authenticated is not None
|
|
355
|
+
):
|
|
356
|
+
retry = client.callback_not_authenticated(client, path)
|
|
357
|
+
if retry:
|
|
358
|
+
return status_code, True
|
|
359
|
+
raise
|
|
313
360
|
elif status_code in [500, 502]:
|
|
314
361
|
try:
|
|
315
362
|
stacktrace = request.json().get(
|
|
@@ -324,7 +371,7 @@ def check_status(request, path):
|
|
|
324
371
|
except Exception:
|
|
325
372
|
print(request.text)
|
|
326
373
|
raise ServerErrorException(path)
|
|
327
|
-
return status_code
|
|
374
|
+
return status_code, False
|
|
328
375
|
|
|
329
376
|
|
|
330
377
|
def fetch_all(path, params=None, client=default_client):
|
|
@@ -413,10 +460,15 @@ def upload(path, file_path, data={}, extra_files=[], client=default_client):
|
|
|
413
460
|
"""
|
|
414
461
|
url = get_full_url(path, client)
|
|
415
462
|
files = _build_file_dict(file_path, extra_files)
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
463
|
+
retry = True
|
|
464
|
+
while retry:
|
|
465
|
+
response = client.session.post(
|
|
466
|
+
url,
|
|
467
|
+
data=data,
|
|
468
|
+
headers=make_auth_header(client=client),
|
|
469
|
+
files=files,
|
|
470
|
+
)
|
|
471
|
+
_, retry = check_status(response, path, client=client)
|
|
420
472
|
try:
|
|
421
473
|
result = response.json()
|
|
422
474
|
except JSONDecodeError:
|
|
@@ -465,12 +517,14 @@ def get_file_data_from_url(url, full=False, client=default_client):
|
|
|
465
517
|
"""
|
|
466
518
|
if not full:
|
|
467
519
|
url = get_full_url(url)
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
520
|
+
retry = True
|
|
521
|
+
while retry:
|
|
522
|
+
response = requests.get(
|
|
523
|
+
url,
|
|
524
|
+
stream=True,
|
|
525
|
+
headers=make_auth_header(client=client),
|
|
526
|
+
)
|
|
527
|
+
_, retry = check_status(response, url, client=client)
|
|
474
528
|
return response.content
|
|
475
529
|
|
|
476
530
|
|
|
@@ -658,6 +658,15 @@ def import_otio(
|
|
|
658
658
|
def export_shots_with_csv(
|
|
659
659
|
project, csv_file_path, episode=None, assigned_to=None, client=default
|
|
660
660
|
):
|
|
661
|
+
"""
|
|
662
|
+
Export shots in a csv file.
|
|
663
|
+
|
|
664
|
+
Args:
|
|
665
|
+
project (str / dict): The project dict or the project ID.
|
|
666
|
+
csv_file_path (str): The csv file path.
|
|
667
|
+
episode (str / dict): The episode dict or the episode ID (optional).
|
|
668
|
+
assigned_to (str / dict): The user dict or the user ID (optional).
|
|
669
|
+
"""
|
|
661
670
|
project = normalize_model_parameter(project)
|
|
662
671
|
episode = normalize_model_parameter(episode)
|
|
663
672
|
assigned_to = normalize_model_parameter(assigned_to)
|
gazu-0.10.9/gazu/__version__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.10.9"
|
|
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
|