Yahoo Finance one maintained an API.
However, this one is where it is at:
Basic use of yfinance:
from pandas_datareader import data as pdr
import yfinance as yf
The library is pretty deep. However, for most things, IMO, the “ticker” class is probably all you need.
aaplObj = yf.Ticker(“AAPL”)
# get dividends for 2018