We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b579604 commit 598431dCopy full SHA for 598431d
web_programming/current_stock_price.py
@@ -24,9 +24,8 @@ def stock_price(symbol: str = "AAPL") -> str:
24
url, headers={"USER-AGENT": "Mozilla/5.0"}, timeout=10
25
).text
26
soup = BeautifulSoup(yahoo_finance_source, "html.parser")
27
- specific_fin_streamer_tag = soup.find("span", {"data-testid": "qsp-price"})
28
29
- if specific_fin_streamer_tag:
+ if specific_fin_streamer_tag := soup.find("span", {"data-testid": "qsp-price"}):
30
text = specific_fin_streamer_tag.get_text()
31
return text
32
return "No <fin-streamer> tag with the specified data-testid attribute found."
0 commit comments