We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents fd1f93e + 598431d commit 60f6efeCopy full SHA for 60f6efe
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