Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -16,11 +16,9 @@ def get_stock_price(ticker: str) -> str:
|
|
16 |
Fetches the latest stock price for a given ticker symbol from Yahoo Finance.
|
17 |
|
18 |
Args:
|
19 |
-
ticker
|
20 |
|
21 |
-
|
22 |
-
str: The current stock price or an error message if the price cannot be retrieved.
|
23 |
-
"""
|
24 |
url = f"https://finance.yahoo.com/quote/{ticker}"
|
25 |
headers = {"User-Agent": "Mozilla/5.0"} # Avoid bot detection
|
26 |
response = requests.get(url, headers=headers)
|
|
|
16 |
Fetches the latest stock price for a given ticker symbol from Yahoo Finance.
|
17 |
|
18 |
Args:
|
19 |
+
ticker: A string representing the stock ticker symbol (e.g., "AAPL" for Apple).
|
20 |
|
21 |
+
|
|
|
|
|
22 |
url = f"https://finance.yahoo.com/quote/{ticker}"
|
23 |
headers = {"User-Agent": "Mozilla/5.0"} # Avoid bot detection
|
24 |
response = requests.get(url, headers=headers)
|