Skip to content

Commit

Permalink
wb_wdi: Correct data.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-graves committed Nov 5, 2024
1 parent df7ec1e commit 53ce4d3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions sdmx/source/wb_wdi.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,17 @@ def modify_request_args(self, kwargs):
# Service does not respond to requests for "WB" category schemes
kwargs["provider"] = "all"
elif kwargs.get("resource_type") == Resource.data:
# Provider's own ID differs from its ID in this package
kwargs.setdefault("provider", "WB")
# In this case, the agency_id comes before the resource_id
# Invert key and resource_id exceptionally.
kwargs.setdefault("agency_id", "WDI")
if not isinstance(kwargs["key"], str):
raise ValueError(
"WDI data currently only supports strings as keys"
)
key = kwargs.get("resource_id")
kwargs.setdefault("key", key if key is not None else "")
kwargs.pop("resource_id")
kwargs.setdefault("resource_id", "WDI")
elif kwargs.get("resource_type") == Resource.dataflow:
# Here we have no agency_id (/all/latest is allowed).
# Unless set, it is added automatically, use url to avoid that.
Expand Down

0 comments on commit 53ce4d3

Please sign in to comment.