I’m trying to get the prices from this URL. Can someone tell me what I’m doing wrong?
https://stockcharts.com/h-hd/?%24GSPCE
resp = requests.get(BASE_URL).content soup = BeautifulSoup(resp, 'html.parser') prices = soup.find('div', {'class': 'historical-data-descrip'}) content = str(prices) print(content)
Advertisement
Answer
Stockcharts only provides historical data to StockChart members, so you probably need to pass some kind of authentication.
Or use an api like this one