We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Investigate and implement different and more appropriate exception types, as we're currently handling too many different cases with 'ValueError'.
Also, it looks like when the API returns HTML instead of JSON, we're not always catching it, as in this error case from imf_databases:
KeyError Traceback (most recent call last) Cell In[3], line 9 7 databases = pd.read_parquet(cache_path) 8 else: ----> 9 databases = imfp.imf_databases() 10 os.makedirs("data", exist_ok=True) 11 databases.to_parquet(cache_path)
File ~\Software\Python\imfp\imfp\data.py:37, in imf_databases(times) 32 url = "http://dataservices.imf.org/REST/SDMX_JSON.svc/Dataflow" 33 raw_dl = _download_parse(url, times) 35 database_id = [ 36 dataflow["KeyFamilyRef"]["KeyFamilyID"] ---> 37 for dataflow in raw_dl["Structure"]["Dataflows"]["Dataflow"] 38 ] 40 description = [ 41 dataflow["Name"]["#text"] 42 for dataflow in raw_dl["Structure"]["Dataflows"]["Dataflow"] 43 ] 44 database_list = DataFrame({"database_id": database_id, "description": description})
KeyError: 'Structure'
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Investigate and implement different and more appropriate exception types, as we're currently handling too many different cases with 'ValueError'.
Also, it looks like when the API returns HTML instead of JSON, we're not always catching it, as in this error case from imf_databases:
KeyError Traceback (most recent call last)
Cell In[3], line 9
7 databases = pd.read_parquet(cache_path)
8 else:
----> 9 databases = imfp.imf_databases()
10 os.makedirs("data", exist_ok=True)
11 databases.to_parquet(cache_path)
File ~\Software\Python\imfp\imfp\data.py:37, in imf_databases(times)
32 url = "http://dataservices.imf.org/REST/SDMX_JSON.svc/Dataflow"
33 raw_dl = _download_parse(url, times)
35 database_id = [
36 dataflow["KeyFamilyRef"]["KeyFamilyID"]
---> 37 for dataflow in raw_dl["Structure"]["Dataflows"]["Dataflow"]
38 ]
40 description = [
41 dataflow["Name"]["#text"]
42 for dataflow in raw_dl["Structure"]["Dataflows"]["Dataflow"]
43 ]
44 database_list = DataFrame({"database_id": database_id, "description": description})
KeyError: 'Structure'
The text was updated successfully, but these errors were encountered: