antmontieri commited on
Commit
a661a66
·
verified ·
1 Parent(s): 5a0650c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -46,7 +46,7 @@ def fetch_page_text(url: str) -> str:
46
  paragraphs = soup.find_all('p')
47
  return '\n'.join(p.get_text() for p in paragraphs if p.get_text().strip())
48
  except Exception as e:
49
- return f"Impossible access to the page: {e}"
50
 
51
  def web_search(query: str, max_results: int = 5) -> list:
52
  """Simple DuckDuckGo web search via DDGS"""
@@ -77,11 +77,11 @@ def atp_player_tournament(player: str, month: str, year: str) -> str:
77
  if not re.fullmatch(r"\d{4}", year):
78
  return f"Invalid year: '{year}'"
79
 
80
- query = f"{player} ATP tournaments {month_full} {year} site:atptour.com"
81
  results = web_search(query)
82
 
83
  if not results or not isinstance(results, list):
84
- return f"No results found for {player} in {month_full} {year}."
85
 
86
  # --- OUTPUT COMPOSITION ---
87
  output = f"Tournaments for {player} in {month_full} {year}:\n\n"
 
46
  paragraphs = soup.find_all('p')
47
  return '\n'.join(p.get_text() for p in paragraphs if p.get_text().strip())
48
  except Exception as e:
49
+ return f"Unable to access page: {e}"
50
 
51
  def web_search(query: str, max_results: int = 5) -> list:
52
  """Simple DuckDuckGo web search via DDGS"""
 
77
  if not re.fullmatch(r"\d{4}", year):
78
  return f"Invalid year: '{year}'"
79
 
80
+ query = f"{player} ATP tournaments {month_full} {year}"
81
  results = web_search(query)
82
 
83
  if not results or not isinstance(results, list):
84
+ return f"No results found for {player} in {month_full} {year}.\nQuery used: '{query}'"
85
 
86
  # --- OUTPUT COMPOSITION ---
87
  output = f"Tournaments for {player} in {month_full} {year}:\n\n"