meirk-brd commited on
Commit
173b4ae
·
1 Parent(s): 258dbf2

Add debug logging to trace URL parameter handling

Browse files
Files changed (2) hide show
  1. app.py +3 -0
  2. tool.py +9 -0
app.py CHANGED
@@ -18,6 +18,9 @@ def toggle_fields(selected: str):
18
 
19
 
20
  def run(dataset: str, url: str, keyword: str, first_name: str, last_name: str, days_limit: str, num_of_reviews: str, num_of_comments: str) -> str:
 
 
 
21
  return tool(
22
  dataset=dataset,
23
  url=url,
 
18
 
19
 
20
  def run(dataset: str, url: str, keyword: str, first_name: str, last_name: str, days_limit: str, num_of_reviews: str, num_of_comments: str) -> str:
21
+ import sys
22
+ print(f"[DEBUG app.run] Received url: {url!r} (type: {type(url).__name__})", file=sys.stderr)
23
+
24
  return tool(
25
  dataset=dataset,
26
  url=url,
tool.py CHANGED
@@ -81,8 +81,14 @@ class BrightDataDatasetTool(Tool):
81
  num_of_comments: Optional[str] = None,
82
  ) -> str:
83
  try:
 
 
 
 
84
  url = self._coerce_url_input(url)
85
 
 
 
86
  api_token = os.getenv("BRIGHT_DATA_API_TOKEN")
87
  if not api_token:
88
  raise ValueError("BRIGHT_DATA_API_TOKEN not found in environment variables")
@@ -208,6 +214,9 @@ class BrightDataDatasetTool(Tool):
208
  raise TimeoutError(f"Timeout waiting for snapshot {snapshot_id} after {max_attempts} seconds")
209
 
210
  def _coerce_url_input(self, raw: Optional[Any]) -> Optional[str]:
 
 
 
211
  if raw is None:
212
  return None
213
 
 
81
  num_of_comments: Optional[str] = None,
82
  ) -> str:
83
  try:
84
+ # Debug logging
85
+ import sys
86
+ print(f"[DEBUG forward] Received url parameter: {url!r} (type: {type(url).__name__})", file=sys.stderr)
87
+
88
  url = self._coerce_url_input(url)
89
 
90
+ print(f"[DEBUG forward] After coerce: {url!r}", file=sys.stderr)
91
+
92
  api_token = os.getenv("BRIGHT_DATA_API_TOKEN")
93
  if not api_token:
94
  raise ValueError("BRIGHT_DATA_API_TOKEN not found in environment variables")
 
214
  raise TimeoutError(f"Timeout waiting for snapshot {snapshot_id} after {max_attempts} seconds")
215
 
216
  def _coerce_url_input(self, raw: Optional[Any]) -> Optional[str]:
217
+ import sys
218
+ print(f"[DEBUG _coerce_url_input] Input: {raw!r} (type: {type(raw).__name__})", file=sys.stderr)
219
+
220
  if raw is None:
221
  return None
222