hdx-python-api 6.6.6__py3-none-any.whl → 6.6.7__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.
hdx/api/_version.py CHANGED
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '6.6.6'
22
- __version_tuple__ = version_tuple = (6, 6, 6)
21
+ __version__ = version = '6.6.7'
22
+ __version_tuple__ = version_tuple = (6, 6, 7)
23
23
 
24
24
  __commit_id__ = commit_id = None
hdx/data/organization.py CHANGED
@@ -260,7 +260,56 @@ class Organization(HDXObject):
260
260
  List of all organization names in HDX
261
261
  """
262
262
  organization = Organization(configuration=configuration)
263
- return organization._write_to_hdx("list", kwargs)
263
+
264
+ # Early return for the standard, non-paginated case
265
+ if not kwargs.get("all_fields"):
266
+ return organization._write_to_hdx("list", kwargs)
267
+
268
+ compiled_orgs = {}
269
+ # Extract limit and offset to dictate our paging sizes, defaulting to 400 and 0
270
+ page_size = kwargs.pop("limit", 400)
271
+ current_offset = kwargs.pop("offset", 0)
272
+
273
+ # 1. Fetch in pages using the provided/default page size
274
+ while True:
275
+ page_kwargs = kwargs.copy()
276
+ page_kwargs["limit"] = page_size
277
+ page_kwargs["offset"] = current_offset
278
+
279
+ page_data = organization._write_to_hdx("list", page_kwargs)
280
+
281
+ if not page_data:
282
+ break
283
+
284
+ # Store by name to automatically deduplicate offset shifts
285
+ for org in page_data:
286
+ compiled_orgs[org["name"]] = org
287
+
288
+ if len(page_data) < page_size:
289
+ break
290
+
291
+ current_offset += page_size
292
+
293
+ # 2. Establish Ground Truth LAST (without limit/offset constraints)
294
+ truth_kwargs = kwargs.copy()
295
+ truth_kwargs["all_fields"] = False
296
+
297
+ ground_truth_names = organization._write_to_hdx("list", truth_kwargs)
298
+
299
+ # 3 & 4. Check for missing IDs, fetch individually, and implicitly prune deletes
300
+ final_orgs = []
301
+ for name in ground_truth_names:
302
+ if name in compiled_orgs:
303
+ final_orgs.append(compiled_orgs[name])
304
+ else:
305
+ try:
306
+ missing_org = organization._write_to_hdx("show", {"id": name})
307
+ if missing_org:
308
+ final_orgs.append(missing_org)
309
+ except Exception:
310
+ pass
311
+
312
+ return final_orgs
264
313
 
265
314
  @classmethod
266
315
  def autocomplete(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hdx-python-api
3
- Version: 6.6.6
3
+ Version: 6.6.7
4
4
  Summary: HDX Python API for interacting with the Humanitarian Data Exchange
5
5
  Project-URL: Homepage, https://github.com/OCHA-DAP/hdx-python-api
6
6
  Author: Michael Rans
@@ -1,5 +1,5 @@
1
1
  hdx/api/__init__.py,sha256=11ozJKiUsqDCZ3_mcAHhGYUyGK_Unl54djVSBBExFB4,59
2
- hdx/api/_version.py,sha256=ExjJQQs0P3ByYbVeKqojfK1IwhKHopRm142FJqldcBU,520
2
+ hdx/api/_version.py,sha256=gaupI03XvXXNini2yseR4ChEIaIBFpzvuxlfCXiLcM8,520
3
3
  hdx/api/configuration.py,sha256=9WvuVI-3th2Dv70_t_4VoyrlJwB_9qUSN5_zUKbp4sQ,23805
4
4
  hdx/api/hdx_base_configuration.yaml,sha256=9yJYroZwoyMQo6tcxGfWHWvYahnTma7Szx0J5Z378z4,2173
5
5
  hdx/api/locations.py,sha256=blnqOjEASvh0mWgmo2iEE7ES_xOuRwQo3fOMqTPV_P0,4139
@@ -13,7 +13,7 @@ hdx/api/utilities/url_utils.py,sha256=Pb4r-BAqIHYmeoB_i7QjutDp6nOAUh_OHvCtiNLda3
13
13
  hdx/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  hdx/data/dataset.py,sha256=0gS7tQSswTgG0g8YeXg0FL8pFVkocBQSRPFpQAurN00,99455
15
15
  hdx/data/hdxobject.py,sha256=_jlwYjb_CcjaXsTXObknMfq-OiNOcpJfLJ9b1vKV1Zo,27494
16
- hdx/data/organization.py,sha256=JHlCl50g1nh65DzN75OgMdvEcT_wfSIPLkhI5Ms-u8g,10588
16
+ hdx/data/organization.py,sha256=HGopFsCYOWrR7sUtZzZSXq6wLFw4djus2gzg6yNXOqc,12296
17
17
  hdx/data/resource.py,sha256=5j6QK5_J-UFKCT3jZVUZ66VgGsOcCssmGy4jpqdb1N4,34027
18
18
  hdx/data/resource_matcher.py,sha256=Yzk9pWa4zk1p09m6zcZMj0XZf5Y16Pa3KToOdUt7rP8,4247
19
19
  hdx/data/resource_view.py,sha256=GcYkh0iDAe6_m2ErY_A6i3Z7ZFX949eGt1TLnLZv_8s,7346
@@ -24,7 +24,7 @@ hdx/facades/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  hdx/facades/infer_arguments.py,sha256=DvyDuozfOPmoaV7HjhQySojGIrMWW9nos31auQBVVl8,4032
25
25
  hdx/facades/keyword_arguments.py,sha256=aVapHCfqBO6H7xxBgTdK9ISdgrBFsNypPDWihfQ3edU,1125
26
26
  hdx/facades/simple.py,sha256=QWsBkaHG_UM6X3Zu2u3LWVOQzeR24q-EUClrfsL_mkM,1064
27
- hdx_python_api-6.6.6.dist-info/METADATA,sha256=o4V01ehlDyD2YzWP0EbQ_hRuMnOoyXuW_etzGWA-kTk,4945
28
- hdx_python_api-6.6.6.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
29
- hdx_python_api-6.6.6.dist-info/licenses/LICENSE,sha256=wc-4GpMn-ODs-U_bTe1YCiPVgvcjzrpYOx2wPuyAeII,1079
30
- hdx_python_api-6.6.6.dist-info/RECORD,,
27
+ hdx_python_api-6.6.7.dist-info/METADATA,sha256=35tsnxdsqOWuorw9m3crDKA7oc2mgM55VTIk98nutGc,4945
28
+ hdx_python_api-6.6.7.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
29
+ hdx_python_api-6.6.7.dist-info/licenses/LICENSE,sha256=wc-4GpMn-ODs-U_bTe1YCiPVgvcjzrpYOx2wPuyAeII,1079
30
+ hdx_python_api-6.6.7.dist-info/RECORD,,