dpguthrie / yahooquery

Python wrapper for an unofficial Yahoo Finance API
https://yahooquery.dpguthrie.com
MIT License
790 stars 139 forks source link

search behaves erratically #196

Closed staper1960 closed 1 year ago

staper1960 commented 1 year ago

import yahooquery as yq

a=yq.search('US5949181045',first_quote=True) print(a)

This is supposed to return data about ticker MSFT by isin. Worked fine till yesterday. Today, 21/6 sometimes works, and at other times it returns:

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\spera\Pycharmprojects\IBKR API\TWS API\samples\Python\Testbed\WORKING\test2.py", line 3, in a=yq.search('US5949181045',first_quote=True) File "C:\Users\spera\Anaconda3\envs\Python37\lib\site-packages\yahooquery\misc.py", line 61, in search data = _make_request(url, country=country, params=params) File "C:\Users\spera\Anaconda3\envs\Python37\lib\site-packages\yahooquery\misc.py", line 29, in _make_request json = r.json() File "C:\Users\spera\Anaconda3\envs\Python37\lib\site-packages\requests\models.py", line 975, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

dpguthrie commented 1 year ago

This is just a function of YF's own search endpoint, which means I have no control over how items are returned. Going to close as there's nothing I can do here.