Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BBK web service non-standard behaviour #82

Open
3 of 4 tasks
khaeru opened this issue Jun 27, 2021 · 2 comments
Open
3 of 4 tasks

BBK web service non-standard behaviour #82

khaeru opened this issue Jun 27, 2021 · 2 comments
Labels
data-source Issues related to specific web services/data source(s)

Comments

@khaeru
Copy link
Owner

khaeru commented Jun 27, 2021

This issue exists to track non-standard behaviour of the BBK web service.

  1. The service requires a non-standard /metadata path in the URL for non-data endpoints; i.e. data queries are from

    https://example.com/base-url/data/…
    

    but e.g. codelist queries must use:

    http://example.com/base-url/metadata/codelist/…
    
    • Work around using the .source.bbk.Source class.
  2. The service does not properly handle the "version" path component for non-data endpoints.

    • Work around using the .source.bbk.Source class.
  3. Malformed URNs. Returned SDMX-ML documents include content like:

    urn:sdmx:org.sdmx.infomodel.codelist=BBK:CLA_BBK_COLLECTION(1.0)
    

    These URNs include the "package" component (here codelist) but are malformed because they omit the "class" component (should be .Codelist):

    urn:sdmx:org.sdmx.infomodel.codelist.Codelist=BBK:CLA_BBK_COLLECTION(1.0)
    
    • Mention in the sdmx1 documentation.
    • Contact the web service operators to notify them of this error.
@khaeru khaeru added the data-source Issues related to specific web services/data source(s) label Jun 27, 2021
@bwedl
Copy link

bwedl commented Nov 28, 2022

Hi @khaeru,
Is it possible that:

bbk = sdmx.Client("BBK")
flow_msg = bbk.dataflow()

fails due to similar quirks of the BBK endpoint?
It seems that the trailing /all/ in:
https://api.statistiken.bundesbank.de/rest/metadata/dataflow/BBK/all/
is causing a 404.

While https://api.statistiken.bundesbank.de/rest/metadata/dataflow/BBK/ seems to work as expected.

Any chance this could be worked around too?

@khaeru
Copy link
Owner Author

khaeru commented Apr 3, 2023

Yes, that seems correct. One way to work around in code is:

from pathlib import Path

import requests
import sdmx

BBK = sdmx.Client("BBK")

# Use dry_run to get a prepared requests.Request object;
# then strip off the last component for the desired URL
url = BBK.dataflow(dry_run=True).url.rstrip("all/")

# Query this URL, store in a temporary file
path = Path("temp.xml")
path.write_text(requests.get(url).text)

# Read from the temporary file
msg = sdmx.read_sdmx(path)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data-source Issues related to specific web services/data source(s)
Projects
None yet
Development

No branches or pull requests

2 participants