ValueError: Error getting data from the api, no return was given. alphavantage

1.8k Views Asked by At

I was using following code to download the NSE stock data(indian stocks) :

from alpha_vantage.timeseries import TimeSeries

ts = TimeSeries(key='my api key',output_format='pandas')

data, meta_data = ts.get_daily_adjusted(symbol='VEDL.NS', outputsize='full')
data.to_csv('/content/gdrive/My Drive/ColabNotebooks/NSEDATA/VEDL.NS.csv')

Now i am getting

ValueError                                Traceback (most recent call last)
<ipython-input-11-d1a160a06338> in <module>()
      1 i='VEDL'
----> 2 data, meta_data = ts.get_daily_adjusted(symbol='{0}.NS'.format(i), outputsize='full')
      3 data.to_csv('/content/gdrive/My Drive/Colab Notebooks/NSEDATA/{0}.csv'.format(i))

2 frames
/usr/local/lib/python3.6/dist-packages/alpha_vantage/alphavantage.py in _handle_api_call(self, url)
    333             if not json_response:
    334                 raise ValueError(
--> 335                     'Error getting data from the api, no return was given.')
    336             elif "Error Message" in json_response:
    337                 raise ValueError(json_response["Error Message"])

ValueError: Error getting data from the api, no return was given.

I have been using above api for 3 months and it has been working since then. Please help me

2

There are 2 best solutions below

0
Sushil K On

This looks like an issue with Alphavantage with NSE stocks. Even a direct call below is not working today.

https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=ITC.NS&interval=5min&apikey=XXXXX

Hope they fix it soon.

0
Sandeep Shah On

I think they stopped service for NSE since 12th june, BSE is working try BSE instead of NSE in your query