gazu 0.10.18__py2.py3-none-any.whl → 0.10.20__py2.py3-none-any.whl

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/__version__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.10.18"
1
+ __version__ = "0.10.20"
gazu/client.py CHANGED
@@ -2,7 +2,6 @@ import sys
2
2
  import functools
3
3
  import json
4
4
  import shutil
5
- import urllib
6
5
  import os
7
6
 
8
7
  from .encoder import CustomJSONEncoder
@@ -23,8 +22,10 @@ from .exception import (
23
22
 
24
23
  if sys.version_info[0] == 3:
25
24
  from json import JSONDecodeError
25
+ from urllib.parse import urlencode
26
26
  else:
27
27
  JSONDecodeError = ValueError
28
+ from urllib import urlencode
28
29
 
29
30
  DEBUG = os.getenv("GAZU_DEBUG", "false").lower() == "true"
30
31
 
@@ -192,7 +193,7 @@ def get_full_url(path, client=default_client):
192
193
 
193
194
  def build_path_with_params(path, params):
194
195
  """
195
- Add params to a path using urllib encoding
196
+ Add params to a path using urllib encoding.
196
197
 
197
198
  Args:
198
199
  path (str): The url base path
@@ -204,10 +205,13 @@ def build_path_with_params(path, params):
204
205
  if not params:
205
206
  return path
206
207
 
207
- if hasattr(urllib, "urlencode"):
208
- path = "%s?%s" % (path, urllib.urlencode(params))
209
- else:
210
- path = "%s?%s" % (path, urllib.parse.urlencode(params))
208
+ query_string = urlencode(params)
209
+
210
+ if query_string:
211
+ # Support base paths that already contain query parameters.
212
+ path += "&" if "?" in path else "?"
213
+ path += query_string
214
+
211
215
  return path
212
216
 
213
217
 
@@ -400,16 +404,49 @@ def check_status(request, path, client=None):
400
404
  return status_code, False
401
405
 
402
406
 
403
- def fetch_all(path, params=None, client=default_client):
407
+ def fetch_all(
408
+ path, params=None, client=default_client, paginated=False, limit=None
409
+ ):
404
410
  """
405
411
  Args:
406
412
  path (str): The path for which we want to retrieve all entries.
413
+ paginated (bool): Will query entries page by page.
414
+ limit (int): Limit the number of entries per page.
407
415
 
408
416
  Returns:
409
417
  list: All entries stored in database for a given model. You can add a
410
418
  filter to the model name like this: "tasks?project_id=project-id"
411
419
  """
412
- return get(url_path_join("data", path), params=params, client=client)
420
+
421
+ if paginated:
422
+ if not params:
423
+ params = {}
424
+ params["page"] = 1
425
+ if limit is not None:
426
+ params["limit"] = limit
427
+
428
+ url = url_path_join("data", path)
429
+
430
+ response = get(url, params=params, client=client)
431
+
432
+ if not paginated:
433
+ return response
434
+
435
+ nb_pages = response.get("nb_pages", 1)
436
+ current_page = response.get("page", 1)
437
+ results = response.get("data", [])
438
+
439
+ if current_page != nb_pages:
440
+ for page in range(2, nb_pages + 1):
441
+ params["page"] = page
442
+ response = get(
443
+ url,
444
+ params=params,
445
+ client=client,
446
+ )
447
+ results += response.get("data", [])
448
+
449
+ return results
413
450
 
414
451
 
415
452
  def fetch_first(path, params=None, client=default_client):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gazu
3
- Version: 0.10.18
3
+ Version: 0.10.20
4
4
  Summary: Gazu is a client for Zou, the API to store the data of your CG production.
5
5
  Home-page: https://gazu.cg-wire.com/
6
6
  Author: CG Wire
@@ -20,25 +20,27 @@ Classifier: Programming Language :: Python :: 3.9
20
20
  Classifier: Programming Language :: Python :: 3.10
21
21
  Classifier: Programming Language :: Python :: 3.11
22
22
  Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
23
24
  Classifier: Programming Language :: Python :: Implementation :: CPython
24
25
  Classifier: Programming Language :: Python :: Implementation :: PyPy
25
26
  Classifier: Topic :: Multimedia :: Graphics
26
27
  Requires-Python: >= 2.7, != 3.0.*, != 3.1.*, != 3.2.*, != 3.3.*, != 3.4.*, != 3.5.*, != 3.6.1, != 3.6.2
27
28
  License-File: LICENSE
28
- Requires-Dist: requests >=2.25.1
29
- Requires-Dist: Deprecated ==1.2.14
30
- Requires-Dist: python-socketio[client] <6,>=5.11.0 ; python_version != "2.7"
31
- Requires-Dist: pywin32 >=308 ; sys_platform == "win32" and python_version != "2.7"
29
+ Requires-Dist: python-socketio[client]<6,>=5.11.0; python_version != "2.7"
30
+ Requires-Dist: requests>=2.25.1
31
+ Requires-Dist: Deprecated==1.2.15
32
+ Requires-Dist: pywin32>=308; sys_platform == "win32" and python_version != "2.7"
32
33
  Provides-Extra: dev
33
- Requires-Dist: wheel ; extra == 'dev'
34
- Provides-Extra: lint
35
- Requires-Dist: autoflake ==2.3.1 ; (python_version >= "3.8") and extra == 'lint'
36
- Requires-Dist: black ==24.10.0 ; (python_version >= "3.9") and extra == 'lint'
37
- Requires-Dist: pre-commit ==4.0.1 ; (python_version >= "3.9") and extra == 'lint'
34
+ Requires-Dist: wheel; extra == "dev"
38
35
  Provides-Extra: test
39
- Requires-Dist: pytest ; extra == 'test'
40
- Requires-Dist: pytest-cov ; extra == 'test'
41
- Requires-Dist: requests-mock ; extra == 'test'
36
+ Requires-Dist: pytest; extra == "test"
37
+ Requires-Dist: pytest-cov; extra == "test"
38
+ Requires-Dist: requests_mock; extra == "test"
39
+ Requires-Dist: multipart; python_version >= "3.13" and extra == "test"
40
+ Provides-Extra: lint
41
+ Requires-Dist: autoflake==2.3.1; python_version >= "3.8" and extra == "lint"
42
+ Requires-Dist: black==24.10.0; python_version >= "3.9" and extra == "lint"
43
+ Requires-Dist: pre-commit==4.0.1; python_version >= "3.9" and extra == "lint"
42
44
 
43
45
  .. figure:: https://zou.cg-wire.com/kitsu.png
44
46
  :alt: Kitsu Logo
@@ -1,9 +1,9 @@
1
1
  gazu/__init__.py,sha256=gVhtpZsvDiPuqvsEbCrgm6fKw8hluUhqspmlgGNIAvQ,3020
2
- gazu/__version__.py,sha256=v-1GqQyIvDmQj5EPtDb_ZdYDNlTzy0taZU1A8TSJZ9o,24
2
+ gazu/__version__.py,sha256=GK-mfk1_OKOrVwHnlW-8w2bqxLHwEO1cboyTUsbPQsE,24
3
3
  gazu/asset.py,sha256=2D7_2fFElfkS6DrHVh0FI-1H73-vhX7VuYCjRgQPVJ0,14564
4
4
  gazu/cache.py,sha256=MnxrnfYN7wHNTTL7qzkEpYCYzWcolT56fqQ0_RegMbE,5879
5
5
  gazu/casting.py,sha256=0LTdsHaCTHSKEflBWFeuraSaYNYetGkMHAIdg6Lv81U,5059
6
- gazu/client.py,sha256=1Ak9gXp-3tTAHgXYzY_y5CVt1vQjocvtkOGgOrEe_PY,15527
6
+ gazu/client.py,sha256=BpD529a8Z7bV3-AjDuino7xYshiE_Pg9rLIyg7Y10oY,16428
7
7
  gazu/concept.py,sha256=GcOPEmkbtZcSwlX8tnUj9Q5DTPBprSxtmXhlq7ioPwk,3727
8
8
  gazu/context.py,sha256=iUyug8EUz3kkF-kmYlH5JuLp66TUqR3uhAq7CouVd_U,4349
9
9
  gazu/edit.py,sha256=sPSsnzykGr1Htl6ceKulUSVHGhoQLGLeWDni3Pul7BE,4609
@@ -22,8 +22,8 @@ gazu/sorting.py,sha256=qSIO0pOHkj0Tl4gm9BJrYrcifWGGGmsW68Pl86zB_bg,266
22
22
  gazu/sync.py,sha256=0ZJ5Z7Nuh5Kj4cswZCXLpXTLf8zQRcXsBLnurMw-i_E,21627
23
23
  gazu/task.py,sha256=rnOKunR-vXLQPkD5nOufPhppYLLkgAWZS9tYlutCMp0,36412
24
24
  gazu/user.py,sha256=GyJf6mrynHvLllw3Hsiv-6wjaYTHO_PBNkJzyJjJA1A,9556
25
- gazu-0.10.18.dist-info/LICENSE,sha256=2n6rt7r999OuXp8iOqW9we7ORaxWncIbOwN1ILRGR2g,7651
26
- gazu-0.10.18.dist-info/METADATA,sha256=H4FbrMCVtfD2fkwcHAW0nPla_1A-kSgSMOaj-nxaR8g,5347
27
- gazu-0.10.18.dist-info/WHEEL,sha256=0VNUDWQJzfRahYI3neAhz2UVbRCtztpN5dPHAGvmGXc,109
28
- gazu-0.10.18.dist-info/top_level.txt,sha256=nv7fRIVpYYyIlk_66hBmMyvWcSC7UU-r-GE8uC1u1Go,5
29
- gazu-0.10.18.dist-info/RECORD,,
25
+ gazu-0.10.20.dist-info/LICENSE,sha256=2n6rt7r999OuXp8iOqW9we7ORaxWncIbOwN1ILRGR2g,7651
26
+ gazu-0.10.20.dist-info/METADATA,sha256=lqRGATB-Yw-7tP4QmZUs__nF1XLWjx0T-x4qxGVoxK4,5447
27
+ gazu-0.10.20.dist-info/WHEEL,sha256=pxeNX5JdtCe58PUSYP9upmc7jdRPgvT0Gm9kb1SHlVw,109
28
+ gazu-0.10.20.dist-info/top_level.txt,sha256=nv7fRIVpYYyIlk_66hBmMyvWcSC7UU-r-GE8uC1u1Go,5
29
+ gazu-0.10.20.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.5.0)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2-none-any
5
5
  Tag: py3-none-any