yahooquery

raw JSON →
2.4.1 verified Mon Apr 27 auth: no python

Python wrapper for an unofficial Yahoo Finance API. Provides access to stock fundamentals, historical prices, financial data, and more via REST endpoints. Current version: 2.4.1. Release cadence: irregular.

pip install yahooquery
error AttributeError: module 'yahooquery' has no attribute 'Ticker'
cause Incorrect import: using `import yahooquery` instead of `from yahooquery import Ticker`
fix
Use from yahooquery import Ticker
error TypeError: 'NoneType' object is not subscriptable
cause The API returned no data for the given symbol (e.g., delisted or invalid ticker).
fix
Check the symbol exists and is active. Wrap calls in try/except or validate with ticker.summary_profile
error requests.exceptions.HTTPError: 404 Client Error: Not Found
cause Yahoo Finance API endpoint changed or ticker not found.
fix
Update yahooquery to latest version. If persists, the ticker may be delisted.
deprecated The `get_historical` method is deprecated; use `history` instead.
fix Replace .get_historical(period='1y') with .history(period='1y')
gotcha Yahoo Finance API endpoints change frequently. Some methods may break without notice.
fix Always check for updates and test your scripts regularly.
gotcha Rate limiting is not documented. Making too many requests in a short time may result in temporary IP blocks.
fix Insert delays between requests (e.g., time.sleep(1)).

Create a Ticker object and fetch current price.

from yahooquery import Ticker

ticker = Ticker('AAPL')
print(ticker.price)