import requests from bs4 import BeautifulSoup def get_city_attractions(city: str) -> str: """ Fetches the top tourist attractions for the given city. Returns a bullet list of attractions and brief info. """ try: # Example: scrape PlanetWare or Wikipedia page for top attractions url = f"https://www.planetware.com/{city.lower()}/top-rated-tourist-attractions-in-{city.lower()}.htm" resp = requests.get(url) soup = BeautifulSoup(resp.text, "html.parser") attractions = [h2.get_text(strip=True) for h2 in soup.find_all('h2')[:5]] if not attractions: raise Exception("No attractions found") return "\n".join(f"- {a}" for a in attractions) except Exception as e: return f"Could not retrieve attractions for {city} (error: {e})" __ __