OliverSherouse / wbdata

A python library for accessing world bank data
GNU General Public License v2.0
182 stars 55 forks source link

World Development Indicators Dataset Value Error #25

Closed wochner closed 5 years ago

wochner commented 5 years ago

I receive a value error when querying for some of the World Development Indicators data.

indicators = {u'NE.CON.PETC.ZS': u'Household final consumption (%GDP)'} df = wbdata.get_dataframe(indicators, convert_date=False)

Traceback (most recent call last):

File "", line 1, in df = wbdata.get_dataframe(indicators, convert_date=True)

File "", line 2, in get_dataframe

File "C:\ProgramData\Miniconda3\envs\py27\lib\site-packages\wbdata\api.py", line 53, in uses_pandas return f(*args, **kwargs)

File "C:\ProgramData\Miniconda3\envs\py27\lib\site-packages\wbdata\api.py", line 416, in get_dataframe for i in indicators}

File "C:\ProgramData\Miniconda3\envs\py27\lib\site-packages\wbdata\api.py", line 416, in for i in indicators}

File "C:\ProgramData\Miniconda3\envs\py27\lib\site-packages\wbdata\api.py", line 167, in get_data data = fetcher.fetch(query_url, args)

File "C:\ProgramData\Miniconda3\envs\py27\lib\site-packages\wbdata\fetcher.py", line 163, in fetch raw_response = fetch_url(query_url)

File "C:\ProgramData\Miniconda3\envs\py27\lib\site-packages\wbdata\fetcher.py", line 135, in fetch_url raise ValueError

ValueError

and same for NE.CON.PETC.KD.ZG, NV.SRV.TETC.ZS, NV.SRV.TETC.KD.ZG (also queried seperately).

OliverSherouse commented 5 years ago

Unfortunately, this appears to be an upstream problem (search for an indicator here and click on the link that says API and you get this:

[{"message":[{"id":"120","key":"Invalid value","value":"The provided parameter value is not valid"}]}]

Until that gets fixed, the only thing I can really do is pass along a more helpful error.

wochner commented 5 years ago

Understood. Will build a loop and try except each indicator on its own as upstream may continue to be on/off, I think.