dpguthrie / dpguthrie/yahooquery
stock.asset_profile doesn't work for some tickers
- Dominant language
- Python
- Stars
- 920
- Forks
- 164
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
This bug is not specific to the 'assetProfile' module, I've seen it for key_stats and summary_detail as well.
**To Reproduce**
```
>>> stock = Ticker('DAR.DE')
>>> stock.asset_profile
Traceback (most recent call last):
File "/Users/samuel/Library/Python/3.9/lib/python/site-packages/yahooquery/base.py", line 1217, in _construct_data
data = json[response_field]["result"][0][addl_key]
KeyError: 'assetProfile'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File "/Users/samuel/Library/Python/3.9/lib/python/site-packages/yahooquery/ticker.py", line 209, in asset_profile
return self._quote_summary(["assetProfile"])
File "/Users/samuel/Library/Python/3.9/lib/python/site-packages/yahooquery/ticker.py", line 101, in _quote_summary
data = self._get_data(key="quoteSummary", params=params, **kwargs)
File "/Users/samuel/Library/Python/3.9/lib/python/site-packages/yahooquery/base.py", line 1088, in _get_data
data = self._sync_requests(response_field, urls, params, **kwargs)
File "/Users/samuel/Library/Python/3.9/lib/python/site-packages/yahooquery/base.py", line 1185, in _sync_requests
data[symbol] = self._construct_data(json, response_field, **kwargs)
File "/Users/samuel/Library/Python/3.9/lib/python/site-packages/yahooquery/base.py", line 1224, in _construct_data
json[response_field]["result"][addl_key]
TypeError: list indices must be integers or slices, not str
```
**Expected behavior**
A valid result instead of an exception.
**Desktop (please complete the following information):**
- OS: MacOS 13.4.1
- Version: 2.3.2
Contributor guide
Assessment
This issue has not been assessed yet.