Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 19113

AttributeError: 'NoneType' object has no attribute 'text'. while Web scraping

$
0
0

I get the following error when trying to AttributeError: 'NoneType' object has no attribute 'text'

    import requests    from bs4 import BeautifulSoup     import numpy as np    headers = {"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36",     }     html = requests.get("https://finance.yahoo.com/quote/BSPAX", headers=headers)     soup = BeautifulSoup(html.text, "html.parser")     A1=[float(soup.find("fin-streamer", class_="Fw(b) Fz(36px) Mb(-4px) D(ib)").text)]

Viewing all articles
Browse latest Browse all 19113

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>