hdx-python-api 6.3.3__tar.gz → 6.3.5__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.
Files changed (131) hide show
  1. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/.config/pre-commit-config.yaml +3 -3
  2. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/PKG-INFO +4 -8
  3. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/pyproject.toml +6 -6
  4. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/requirements.txt +40 -55
  5. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/api/_version.py +2 -2
  6. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/data/dataset.py +35 -0
  7. hdx_python_api-6.3.5/tests/hdx/data/test_dataset_add_hapi_error.py +71 -0
  8. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/hdx/data/test_dataset_noncore.py +0 -770
  9. hdx_python_api-6.3.5/tests/hdx/data/test_dataset_resource_generation.py +785 -0
  10. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/.config/coveragerc +0 -0
  11. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/.config/pytest.ini +0 -0
  12. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/.config/ruff.toml +0 -0
  13. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/.github/workflows/publish.yaml +0 -0
  14. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/.github/workflows/run-python-tests.yaml +0 -0
  15. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/.gitignore +0 -0
  16. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/CONTRIBUTING.md +0 -0
  17. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/LICENSE +0 -0
  18. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/README.md +0 -0
  19. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/documentation/.readthedocs.yaml +0 -0
  20. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/documentation/main.md +0 -0
  21. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/documentation/pydoc-markdown.yaml +0 -0
  22. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/api/__init__.py +0 -0
  23. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/api/configuration.py +0 -0
  24. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/api/hdx_base_configuration.yaml +0 -0
  25. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/api/locations.py +0 -0
  26. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/api/remotehdx.py +0 -0
  27. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/data/__init__.py +0 -0
  28. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/data/dataset_title_helper.py +0 -0
  29. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/data/date_helper.py +0 -0
  30. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/data/filestore_helper.py +0 -0
  31. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/data/hdx_datasource_topline.yaml +0 -0
  32. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/data/hdxobject.py +0 -0
  33. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/data/indicator_resource_view_template.yaml +0 -0
  34. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/data/organization.py +0 -0
  35. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/data/resource.py +0 -0
  36. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/data/resource_matcher.py +0 -0
  37. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/data/resource_view.py +0 -0
  38. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/data/showcase.py +0 -0
  39. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/data/user.py +0 -0
  40. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/data/vocabulary.py +0 -0
  41. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/facades/__init__.py +0 -0
  42. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/facades/infer_arguments.py +0 -0
  43. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/facades/keyword_arguments.py +0 -0
  44. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/src/hdx/facades/simple.py +0 -0
  45. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/Accepted_Tags.csv +0 -0
  46. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/CKAN/hdx_dataset_static.yaml +0 -0
  47. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/Tag_Mapping.csv +0 -0
  48. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/Tag_Mapping_ChainRuleError.csv +0 -0
  49. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/empty.yaml +0 -0
  50. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/hdx_base_config.json +0 -0
  51. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/hdx_base_config.yaml +0 -0
  52. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/hdx_config.json +0 -0
  53. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/hdx_config.yaml +0 -0
  54. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/hdx_dataset_static.json +0 -0
  55. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/hdx_dataset_static.yaml +0 -0
  56. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/hdx_datasource_topline.json +0 -0
  57. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/hdx_datasource_topline.yaml +0 -0
  58. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/hdx_email_configuration.json +0 -0
  59. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/hdx_email_configuration.yaml +0 -0
  60. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/hdx_missing_site_config.json +0 -0
  61. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/hdx_organization_static.json +0 -0
  62. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/hdx_organization_static.yaml +0 -0
  63. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/hdx_resource_static.json +0 -0
  64. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/hdx_resource_static.yaml +0 -0
  65. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/hdx_resource_view_static.json +0 -0
  66. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/hdx_resource_view_static.yaml +0 -0
  67. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/hdx_showcase_static.json +0 -0
  68. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/hdx_showcase_static.yaml +0 -0
  69. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/hdx_user_static.json +0 -0
  70. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/hdx_user_static.yaml +0 -0
  71. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/hdx_vocabulary_static.json +0 -0
  72. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/hdx_vocabulary_static.yaml +0 -0
  73. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/project_configuration.json +0 -0
  74. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/project_configuration.yaml +0 -0
  75. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/user_agent_config.yaml +0 -0
  76. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/user_agent_config2.yaml +0 -0
  77. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/user_agent_config3.yaml +0 -0
  78. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/config/user_agent_config_wrong.yaml +0 -0
  79. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/dataset_search_results.yaml +0 -0
  80. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/datastore/ACLED-All-Africa-File_20170101-to-20170708.xlsx +0 -0
  81. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/empty.csv +0 -0
  82. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/gen_resource/conflict_data_alg.csv +0 -0
  83. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/gen_resource/min_qc_conflict_data_alg.csv +0 -0
  84. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/gen_resource/qc_conflict_data_alg.csv +0 -0
  85. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/gen_resource/test_data_no_data.csv +0 -0
  86. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/gen_resource/test_data_no_years.csv +0 -0
  87. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/organization_show_results.yaml +0 -0
  88. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/qc_from_rows/qc_conflict_data_alg.csv +0 -0
  89. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/qc_from_rows/qc_conflict_data_alg_one_col.csv +0 -0
  90. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/resource_formats.json +0 -0
  91. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/showcase_all_search_results.yaml +0 -0
  92. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/test_data.csv +0 -0
  93. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/test_data.zip +0 -0
  94. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/update_dataset_resources/dem_data_zwe.csv +0 -0
  95. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/update_dataset_resources/dem_indicatorlist_zwe.csv +0 -0
  96. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/update_dataset_resources/expected_resources_to_update.json +0 -0
  97. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/update_dataset_resources/opri_data_zwe.csv +0 -0
  98. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/update_dataset_resources/opri_indicatorlist_zwe.csv +0 -0
  99. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/update_dataset_resources/opri_metadata_zwe.csv +0 -0
  100. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/update_dataset_resources/qc_sdg_data_zwe.csv +0 -0
  101. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/update_dataset_resources/sdg_data_zwe.csv +0 -0
  102. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/update_dataset_resources/sdg_indicatorlist_zwe.csv +0 -0
  103. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/update_dataset_resources/sdg_metadata_zwe.csv +0 -0
  104. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/update_dataset_resources/unesco_dataset.json +0 -0
  105. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/update_dataset_resources/unesco_update_dataset.json +0 -0
  106. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/update_logic/update_logic_resources.yaml +0 -0
  107. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/fixtures/update_logic/update_logic_resources_new.yaml +0 -0
  108. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/hdx/api/test_ckan.py +0 -0
  109. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/hdx/api/test_configuration.py +0 -0
  110. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/hdx/api/test_locations.py +0 -0
  111. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/hdx/conftest.py +0 -0
  112. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/hdx/data/__init__.py +0 -0
  113. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/hdx/data/test_dataset_core.py +0 -0
  114. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/hdx/data/test_dataset_title_helper.py +0 -0
  115. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/hdx/data/test_filestore_helper.py +0 -0
  116. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/hdx/data/test_organization.py +0 -0
  117. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/hdx/data/test_resource.py +0 -0
  118. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/hdx/data/test_resource_view.py +0 -0
  119. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/hdx/data/test_showcase.py +0 -0
  120. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/hdx/data/test_update_dataset_resources.py +0 -0
  121. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/hdx/data/test_update_logic.py +0 -0
  122. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/hdx/data/test_user.py +0 -0
  123. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/hdx/data/test_vocabulary.py +0 -0
  124. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/hdx/facades/__init__.py +0 -0
  125. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/hdx/facades/test_infer_arguments.py +0 -0
  126. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/hdx/facades/test_keyword_arguments.py +0 -0
  127. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/tests/hdx/facades/test_simple.py +0 -0
  128. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/workingexample/my_code.py +0 -0
  129. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/workingexample/my_resource.csv +0 -0
  130. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/workingexample/my_resource.xlsx +0 -0
  131. {hdx_python_api-6.3.3 → hdx_python_api-6.3.5}/workingexample/run.py +0 -0
@@ -2,13 +2,13 @@ default_language_version:
2
2
  python: python3.12
3
3
  repos:
4
4
  - repo: https://github.com/pre-commit/pre-commit-hooks
5
- rev: v4.6.0
5
+ rev: v5.0.0
6
6
  hooks:
7
7
  - id: trailing-whitespace
8
8
  - id: end-of-file-fixer
9
9
  - id: check-ast
10
10
  - repo: https://github.com/astral-sh/ruff-pre-commit
11
- rev: v0.6.4
11
+ rev: v0.7.0
12
12
  hooks:
13
13
  # Run the linter.
14
14
  - id: ruff
@@ -17,7 +17,7 @@ repos:
17
17
  - id: ruff-format
18
18
  args: [--config, .config/ruff.toml]
19
19
  - repo: https://github.com/astral-sh/uv-pre-commit
20
- rev: 0.4.5
20
+ rev: 0.4.24
21
21
  hooks:
22
22
  # Run the pip compile
23
23
  - id: pip-compile
@@ -1,11 +1,10 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: hdx-python-api
3
- Version: 6.3.3
3
+ Version: 6.3.5
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
7
7
  License: MIT
8
- License-File: LICENSE
9
8
  Keywords: API,CKAN,HDX,humanitarian data exchange
10
9
  Classifier: Development Status :: 5 - Production/Stable
11
10
  Classifier: Intended Audience :: Developers
@@ -28,13 +27,10 @@ Requires-Python: >=3.8
28
27
  Requires-Dist: ckanapi>=4.8
29
28
  Requires-Dist: defopt>=6.4.0
30
29
  Requires-Dist: email-validator
31
- Requires-Dist: hdx-python-country>=3.7.8
32
- Requires-Dist: hdx-python-utilities>=3.7.3
33
- Requires-Dist: libhxl>=5.2.1
30
+ Requires-Dist: hdx-python-country>=3.8.3
31
+ Requires-Dist: hdx-python-utilities>=3.7.4
32
+ Requires-Dist: libhxl>=5.2.2
34
33
  Requires-Dist: makefun
35
- Requires-Dist: ndg-httpsclient
36
- Requires-Dist: pyasn1
37
- Requires-Dist: pyopenssl
38
34
  Requires-Dist: quantulum3
39
35
  Requires-Dist: requests
40
36
  Provides-Extra: dev
@@ -37,13 +37,10 @@ dependencies = [
37
37
  "ckanapi>=4.8",
38
38
  "defopt>=6.4.0",
39
39
  "email_validator",
40
- "hdx-python-country>=3.7.8",
41
- "hdx-python-utilities>=3.7.3",
42
- "libhxl>=5.2.1",
40
+ "hdx-python-country>=3.8.3",
41
+ "hdx-python-utilities>=3.7.4",
42
+ "libhxl>=5.2.2",
43
43
  "makefun",
44
- "ndg-httpsclient",
45
- "pyasn1",
46
- "pyOpenSSL",
47
44
  "quantulum3",
48
45
  "requests",
49
46
  ]
@@ -97,6 +94,9 @@ run = """
97
94
  --cov-report=lcov --cov-report=term-missing
98
95
  """
99
96
 
97
+ [tool.hatch.envs.hatch-static-analysis]
98
+ dependencies = ["ruff==0.7.0"]
99
+
100
100
  [tool.hatch.envs.hatch-static-analysis.scripts]
101
101
  format-check = ["ruff format --config .config/ruff.toml --check --diff {args:.}",]
102
102
  format-fix = ["ruff format --config .config/ruff.toml {args:.}",]
@@ -12,27 +12,23 @@ cachetools==5.5.0
12
12
  # via google-auth
13
13
  certifi==2024.8.30
14
14
  # via requests
15
- cffi==1.17.1
16
- # via cryptography
17
15
  cfgv==3.4.0
18
16
  # via pre-commit
19
17
  chardet==5.2.0
20
18
  # via frictionless
21
- charset-normalizer==3.3.2
19
+ charset-normalizer==3.4.0
22
20
  # via requests
23
21
  ckanapi==4.8
24
22
  # via hdx-python-api (pyproject.toml)
25
23
  click==8.1.7
26
24
  # via typer
27
- coverage==7.6.1
25
+ coverage==7.6.4
28
26
  # via pytest-cov
29
- cryptography==43.0.1
30
- # via pyopenssl
31
27
  defopt==6.4.0
32
28
  # via hdx-python-api (pyproject.toml)
33
- distlib==0.3.8
29
+ distlib==0.3.9
34
30
  # via virtualenv
35
- dnspython==2.6.1
31
+ dnspython==2.7.0
36
32
  # via email-validator
37
33
  docopt==0.6.2
38
34
  # via
@@ -42,74 +38,72 @@ docutils==0.21.2
42
38
  # via defopt
43
39
  email-validator==2.2.0
44
40
  # via hdx-python-api (pyproject.toml)
45
- et-xmlfile==1.1.0
41
+ et-xmlfile==2.0.0
46
42
  # via openpyxl
47
- filelock==3.15.4
43
+ filelock==3.16.1
48
44
  # via virtualenv
49
- frictionless==5.17.1
45
+ frictionless==5.18.0
50
46
  # via hdx-python-utilities
51
- google-auth==2.34.0
47
+ google-auth==2.36.0
52
48
  # via
53
49
  # google-auth-oauthlib
54
50
  # gspread
55
51
  google-auth-oauthlib==1.2.1
56
52
  # via gspread
57
- gspread==6.1.2
53
+ gspread==6.1.4
58
54
  # via hdx-python-api (pyproject.toml)
59
- hdx-python-country==3.7.8
55
+ hdx-python-country==3.8.3
60
56
  # via hdx-python-api (pyproject.toml)
61
- hdx-python-utilities==3.7.3
57
+ hdx-python-utilities==3.7.4
62
58
  # via
63
59
  # hdx-python-api (pyproject.toml)
64
60
  # hdx-python-country
65
- humanize==4.10.0
61
+ humanize==4.11.0
66
62
  # via frictionless
67
- identify==2.6.0
63
+ identify==2.6.1
68
64
  # via pre-commit
69
- idna==3.8
65
+ idna==3.10
70
66
  # via
71
67
  # email-validator
72
68
  # requests
73
69
  ijson==3.3.0
74
70
  # via hdx-python-utilities
75
- inflect==7.3.1
71
+ inflect==7.4.0
76
72
  # via quantulum3
77
73
  iniconfig==2.0.0
78
74
  # via pytest
79
- isodate==0.6.1
75
+ isodate==0.7.2
80
76
  # via frictionless
81
77
  jinja2==3.1.4
82
78
  # via frictionless
83
79
  jsonlines==4.0.0
84
80
  # via hdx-python-utilities
85
- jsonpath-ng==1.6.1
81
+ jsonpath-ng==1.7.0
86
82
  # via libhxl
87
83
  jsonschema==4.23.0
88
84
  # via
89
85
  # frictionless
90
86
  # tableschema-to-template
91
- jsonschema-specifications==2023.12.1
87
+ jsonschema-specifications==2024.10.1
92
88
  # via jsonschema
93
- libhxl==5.2.1
89
+ libhxl==5.2.2
94
90
  # via
95
91
  # hdx-python-api (pyproject.toml)
96
92
  # hdx-python-country
97
93
  loguru==0.7.2
98
94
  # via hdx-python-utilities
99
- makefun==1.15.4
95
+ makefun==1.15.6
100
96
  # via hdx-python-api (pyproject.toml)
101
97
  markdown-it-py==3.0.0
102
98
  # via rich
103
99
  marko==2.1.2
104
100
  # via frictionless
105
- markupsafe==2.1.5
101
+ markupsafe==3.0.2
106
102
  # via jinja2
107
103
  mdurl==0.1.2
108
104
  # via markdown-it-py
109
105
  more-itertools==10.5.0
110
106
  # via inflect
111
- ndg-httpsclient==0.5.1
112
- # via hdx-python-api (pyproject.toml)
113
107
  nodeenv==1.9.1
114
108
  # via pre-commit
115
109
  num2words==0.5.13
@@ -122,7 +116,7 @@ packaging==24.1
122
116
  # via pytest
123
117
  petl==1.7.15
124
118
  # via frictionless
125
- platformdirs==4.2.2
119
+ platformdirs==4.3.6
126
120
  # via virtualenv
127
121
  pluggy==1.5.0
128
122
  # via pytest
@@ -132,35 +126,27 @@ ply==3.11
132
126
  # libhxl
133
127
  pockets==0.9.1
134
128
  # via sphinxcontrib-napoleon
135
- pre-commit==3.8.0
129
+ pre-commit==4.0.1
136
130
  # via hdx-python-api (pyproject.toml)
137
- pyasn1==0.6.0
131
+ pyasn1==0.6.1
138
132
  # via
139
- # hdx-python-api (pyproject.toml)
140
- # ndg-httpsclient
141
133
  # pyasn1-modules
142
134
  # rsa
143
- pyasn1-modules==0.4.0
135
+ pyasn1-modules==0.4.1
144
136
  # via google-auth
145
- pycparser==2.22
146
- # via cffi
147
- pydantic==2.9.0
137
+ pydantic==2.9.2
148
138
  # via frictionless
149
- pydantic-core==2.23.2
139
+ pydantic-core==2.23.4
150
140
  # via pydantic
151
141
  pygments==2.18.0
152
142
  # via rich
153
- pyopenssl==24.2.1
154
- # via
155
- # hdx-python-api (pyproject.toml)
156
- # ndg-httpsclient
157
143
  pyphonetics==0.5.3
158
144
  # via hdx-python-country
159
- pytest==8.3.2
145
+ pytest==8.3.3
160
146
  # via
161
147
  # hdx-python-api (pyproject.toml)
162
148
  # pytest-cov
163
- pytest-cov==5.0.0
149
+ pytest-cov==6.0.0
164
150
  # via hdx-python-api (pyproject.toml)
165
151
  python-dateutil==2.9.0.post0
166
152
  # via
@@ -200,9 +186,9 @@ requests-oauthlib==2.0.0
200
186
  # via google-auth-oauthlib
201
187
  rfc3986==2.0.0
202
188
  # via frictionless
203
- rich==13.8.0
189
+ rich==13.9.4
204
190
  # via typer
205
- rpds-py==0.20.0
191
+ rpds-py==0.21.0
206
192
  # via
207
193
  # jsonschema
208
194
  # referencing
@@ -210,20 +196,19 @@ rsa==4.9
210
196
  # via google-auth
211
197
  ruamel-yaml==0.18.6
212
198
  # via hdx-python-utilities
213
- ruamel-yaml-clib==0.2.8
199
+ ruamel-yaml-clib==0.2.12
214
200
  # via ruamel-yaml
215
- setuptools==74.1.2
201
+ setuptools==75.3.0
216
202
  # via ckanapi
217
203
  shellingham==1.5.4
218
204
  # via typer
219
- simpleeval==0.9.13
205
+ simpleeval==1.0.3
220
206
  # via frictionless
221
207
  simplejson==3.19.3
222
208
  # via ckanapi
223
209
  six==1.16.0
224
210
  # via
225
211
  # ckanapi
226
- # isodate
227
212
  # pockets
228
213
  # python-dateutil
229
214
  # sphinxcontrib-napoleon
@@ -237,11 +222,13 @@ tableschema-to-template==0.0.13
237
222
  # via hdx-python-utilities
238
223
  tabulate==0.9.0
239
224
  # via frictionless
225
+ tenacity==9.0.0
226
+ # via hdx-python-country
240
227
  text-unidecode==1.3
241
228
  # via python-slugify
242
- typeguard==4.3.0
229
+ typeguard==4.4.1
243
230
  # via inflect
244
- typer==0.12.5
231
+ typer==0.13.0
245
232
  # via frictionless
246
233
  typing-extensions==4.12.2
247
234
  # via
@@ -250,19 +237,17 @@ typing-extensions==4.12.2
250
237
  # pydantic-core
251
238
  # typeguard
252
239
  # typer
253
- tzdata==2024.1
254
- # via pydantic
255
240
  unidecode==1.3.8
256
241
  # via
257
242
  # libhxl
258
243
  # pyphonetics
259
- urllib3==2.2.2
244
+ urllib3==2.2.3
260
245
  # via
261
246
  # libhxl
262
247
  # requests
263
248
  validators==0.34.0
264
249
  # via frictionless
265
- virtualenv==20.26.3
250
+ virtualenv==20.27.1
266
251
  # via pre-commit
267
252
  wheel==0.44.0
268
253
  # via libhxl
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '6.3.3'
16
- __version_tuple__ = version_tuple = (6, 3, 3)
15
+ __version__ = version = '6.3.5'
16
+ __version_tuple__ = version_tuple = (6, 3, 5)
@@ -2960,3 +2960,38 @@ class Dataset(HDXObject):
2960
2960
  quickcharts=quickcharts,
2961
2961
  encoding=kwargs.get("encoding", None),
2962
2962
  )
2963
+
2964
+ def add_hapi_error(
2965
+ self,
2966
+ error_message: str,
2967
+ resource_name: Optional[str] = None,
2968
+ resource_id: Optional[str] = None,
2969
+ ) -> bool:
2970
+ """Writes error messages that were uncovered while processing data for
2971
+ the HAPI database to a resource's metadata on HDX. If the resource
2972
+ already has an error message, it is only overwritten if the two
2973
+ messages are different.
2974
+
2975
+ Args:
2976
+ error_message (str): Error(s) uncovered
2977
+ resource_name (Optional[str]): Resource name. Defaults to None
2978
+ resource_id (Optional[str]): Resource id. Defaults to None
2979
+
2980
+ Returns:
2981
+ bool: True if a message was added, False if not
2982
+ """
2983
+ if resource_name is None and resource_id is None:
2984
+ return False
2985
+ resource = None
2986
+ for res in self.get_resources():
2987
+ if res["name"] == resource_name or res["id"] == resource_id:
2988
+ resource = res
2989
+ break
2990
+ if not resource:
2991
+ return False
2992
+ resource_error = resource.get("qa_hapi_report")
2993
+ if resource_error and resource_error == error_message:
2994
+ return False
2995
+ resource["qa_hapi_report"] = error_message
2996
+ resource.update_in_hdx(operation="patch")
2997
+ return True
@@ -0,0 +1,71 @@
1
+ import copy
2
+ import json
3
+
4
+ import pytest
5
+
6
+ from . import MockResponse, dataset_data, dataset_resultdict, resources_data
7
+ from hdx.api.configuration import Configuration
8
+ from hdx.data.dataset import Dataset
9
+
10
+
11
+ class TestDatasetAddHAPIError:
12
+ @pytest.fixture(scope="function")
13
+ def hapi_resource_update(self):
14
+ class MockSession:
15
+ @staticmethod
16
+ def post(url, data, headers, files, allow_redirects, auth=None):
17
+ datadict = json.loads(data.decode("utf-8"))
18
+ if "show" in url:
19
+ resource_id = datadict["id"]
20
+ resources_json = dataset_resultdict["resources"]
21
+ if resource_id == "de6549d8-268b-4dfe-adaf-a4ae5c8510d5":
22
+ resource_json = resources_json[0]
23
+ elif resource_id == "3d777226-96aa-4239-860a-703389d16d1f":
24
+ resource_json = resources_json[1]
25
+ elif resource_id == "3d777226-96aa-4239-860a-703389d16d1g":
26
+ resource_json = resources_json[2]
27
+ else:
28
+ return MockResponse(
29
+ 404,
30
+ '{"success": false, "error": {"message": "TEST ERROR: Invalid id", "__type": "TEST ERROR: Invalid id Error"}, "help": "http://test-data.humdata.org/api/3/action/help_show?name=resource_patch"}',
31
+ )
32
+ result = json.dumps(resource_json)
33
+ return MockResponse(
34
+ 200,
35
+ '{"success": true, "result": %s, "help": "http://test-data.humdata.org/api/3/action/help_show?name=resource_create"}'
36
+ % result,
37
+ )
38
+ if "patch" not in url:
39
+ return MockResponse(
40
+ 404,
41
+ '{"success": false, "error": {"message": "TEST ERROR: Not patch", "__type": "TEST ERROR: Not Patch Error"}, "help": "http://test-data.humdata.org/api/3/action/help_show?name=resource_patch"}',
42
+ )
43
+ result = json.dumps(datadict)
44
+ return MockResponse(
45
+ 200,
46
+ '{"success": true, "result": %s, "help": "http://test-data.humdata.org/api/3/action/help_show?name=resource_patch"}'
47
+ % result,
48
+ )
49
+
50
+ Configuration.read().remoteckan().session = MockSession()
51
+
52
+ def test_add_hapi_error(self, configuration, hapi_resource_update):
53
+ datasetdata = copy.deepcopy(dataset_data)
54
+ resourcesdata = copy.deepcopy(resources_data)
55
+ datasetdata["resources"] = resourcesdata
56
+ dataset = Dataset(datasetdata)
57
+ success = dataset.add_hapi_error(
58
+ error_message="test message",
59
+ resource_name="Resource1",
60
+ )
61
+ assert success is True
62
+ success = dataset.add_hapi_error(
63
+ error_message="test message",
64
+ resource_id="de6549d8-268b-4dfe-adaf-a4ae5c8510d5",
65
+ )
66
+ assert success is False
67
+ success = dataset.add_hapi_error(
68
+ error_message="test message 1",
69
+ resource_name="Resource1",
70
+ )
71
+ assert success is True