'Cannot get an advanced stats from IEX Cloud API
Cannot get the advanced-stats from IEX Cloud. Could you please help me to resolve this tackle? Just to clarify, it works for stats, quotes etc.
import requests
symbol = 'AAPL'
IEX_CLOUD_API_TOKEN = 'sk_80e742117fc345ea92728199633d8f33'
base_url = 'https://cloud.iexapis.com/stable'
url_adv_stats = f'{base_url}/stock/{symbol}/advanced-stats?token={IEX_CLOUD_API_TOKEN}'
response_adv_stats = requests.get(url_adv_stats)
response_adv_stats.json()
The error :
Error file:JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Solution 1:[1]
There is nothing to decode, as you ran out of quota. Please check r.status_code
and also r.text
, as shown below. The status code should be 2XX
. A comprehensive list of status codes can be found here.
import requests
symbol = 'AAPL'
IEX_CLOUD_API_TOKEN = 'sk_80e742117fc345ea92728199633d8f33'
base_url = 'https://cloud.iexapis.com/stable'
url_adv_stats = f'{base_url}/stock/{symbol}/advanced-stats?token={IEX_CLOUD_API_TOKEN}'
r = requests.get(url_adv_stats)
print(r.text)
print(r.status_code)
json = r.json()
print(json)
Output:
The requested data is not available to free tier accounts. Please upgrade for access to this data.
402
...
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | KarelZe |