khaeru / sdmx

SDMX information model and client in Python
https://sdmx1.readthedocs.io
Apache License 2.0
23 stars 18 forks source link

IMF url changed #38

Open bertrandmarc opened 3 years ago

bertrandmarc commented 3 years ago

It seems the url for IMF changed. It is now possible to get data from IMF in SDMX 2.0, 2.1 and JSON. SDMX XML: http://datahelp.imf.org/knowledgebase/articles/1952905-sdmx-2-0-and-sdmx-2-1-restful-web-service SDMX JSON: http://datahelp.imf.org/knowledgebase/articles/667681-using-json-restful-web-service

Unfortunately, to get SDMX XML 2.1 data, one needs to add a parameter format=sdmx-2.1 to all requests, and I don't know how to add that in the sources list.

khaeru commented 3 years ago

Great, thanks for the report.

It's interesting: from that page, it looks like the web service API and URL scheme are those of SDMX 2.0. So it's just that query parameter which allows retrieving messages in SDMX-ML 2.1. I haven't seen a hybrid like that before.

The way to handle this is to set the modify_request_args() hook on a source-specific class. For an example see https://github.com/khaeru/sdmx/blob/30d8145022ce4837fa426055b1039ec8b9910895/sdmx/source/ilo.py#L7-L24

khaeru commented 3 years ago

@bertrandmarc on another look, I am not sure if these pages are current.

It's entirely possible that IMF is operating two services. Maybe one is a legacy one that will eventually be retired, and the other is a modern one. It's also possible the documentation has not been kept up to date (there are no dates mentioned on the pages you linked).

If this is an important data source, would you mind to get in touch with them to ask what the situation is? Better than trying to guess.