I tried the following command. I can retrieve dividend with a token of a free account. But I can not get earnings. Does anybody know what is wrong?
>>> import iexcloud
>>> iexcloud.set_token(mytoken)
>>> stock = Stock("KO")
>>> stock.get_earning(2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/iexcloud/stock.py", line 115, in get_earning
output = self._create_output(response, "earnings")
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/iexcloud/stock.py", line 35, in _create_output
raise response.raise_for_status()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/requests/models.py", line 953, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 451 Client Error: The requested data requires permission to access. for url: https://cloud.iexapis.com/stable/stock/KO/earnings/2?token=mytoken
>>> stock.get_dividend("1y")
amount currency declaredDate description exDate flag frequency paymentDate recordDate refid symbol id key subkey date updated
0 0.42 USD 2021-10-21 Ordinary Shares 2021-11-30 Cash quarterly 2021-12-15 2021-12-01 2342782 KO DIVIDENDS KO 2342782 2021-11-30 1634941806000
1 0.42 USD 2021-07-14 Ordinary Shares 2021-09-14 Cash quarterly 2021-10-01 2021-09-15 2269888 KO DIVIDENDS KO 2269888 2021-09-14 1626348853000
2 0.42 USD 2021-04-21 Ordinary Shares 2021-06-14 Cash quarterly 2021-07-01 2021-06-15 2213420 KO DIVIDENDS KO 2213420 2021-06-14 1619089678000
3 0.42 USD 2021-02-18 Ordinary Shares 2021-03-12 Cash quarterly 2021-04-01 2021-03-15 2168342 KO DIVIDENDS KO 2168342 2021-03-12 1613791601000
I tried the following command. I can retrieve dividend with a token of a free account. But I can not get earnings. Does anybody know what is wrong?