mra1385 / EIA-python

Python Wrapper for the Energy Information Administration (EIA) API
56 stars 13 forks source link

api error not fetching 'Series" data from API #9

Open olegvuk opened 1 year ago

olegvuk commented 1 year ago

Hi, I have been using this package fine up to now, but just recently began throwing up an error from the following code, as an

api_key = "XXX" api = eia.API(api_key)

Lower 48

series_search = api.data_by_series(series='NG.NW2_EPG0_SWO_R48_BCF.W')

I now get this error: --------------------------------------------------------------------------- KeyError Traceback (most recent call last) Input In [1], in <cell line: 28>() 24 api = eia.API(api_key) 27 ###Lower 48 ---> 28 series_search = api.data_by_series(series='NG.NW2_EPG0_SWO_R48_BCF.W') 30 for key,value in series_search.items(): 31 print(key,value)

File ~\anaconda3\lib\site-packages\eia\api.py:424, in API.data_by_series(self, series) 420 raise InvalidSeries(error_msg) 422 else: 423 lst_dates = [x[0][0:4] + " " + x[0][4:] + " " + x[0][6:8] --> 424 for x in search.json()['series'][0]['data']] 425 lst_values = [x[1] for x in 426 search.json()['series'][0]['data']] 427 dates_values_dict = dict(zip(lst_dates, lst_values))

KeyError: 'series'

do you have any ideas what could be causing it or a fix?

olegvuk commented 1 year ago

EIA deprecated the method of calling the API using here on March 13, 2023

neevista commented 1 year ago

Hi @olegvuk , So this python library in not working at all after this change on Mar 13, 2023? Thanks.

olegvuk commented 1 year ago

hi @neevista yes not working at all anymore