fix: use hardcoded default base URL for report_url fallback
All checks were successful
Build and Push Docker Image / build (push) Successful in 43s
All checks were successful
Build and Push Docker Image / build (push) Successful in 43s
The SCHWAB_MCP_BASE_URL env var may not be set in all deployment environments. Default to https://schwab-mcp.ext.ben.io so the report_url enrichment works out of the box.
This commit is contained in:
@@ -69,6 +69,8 @@ try:
|
|||||||
except Exception:
|
except Exception:
|
||||||
_startup_logger.info("schwab-scraper package version: (unknown)")
|
_startup_logger.info("schwab-scraper package version: (unknown)")
|
||||||
|
|
||||||
|
_DEFAULT_BASE_URL = "https://schwab-mcp.ext.ben.io"
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Log capture helper — captures scraper logs to a string buffer AND tees
|
# Log capture helper — captures scraper logs to a string buffer AND tees
|
||||||
@@ -477,9 +479,8 @@ async def get_morningstar_data(ticker: str, debug: bool = False) -> str:
|
|||||||
):
|
):
|
||||||
data = result["data"]
|
data = result["data"]
|
||||||
if hasattr(data, "report_url") and data.report_url is None and data.source is not None:
|
if hasattr(data, "report_url") and data.report_url is None and data.source is not None:
|
||||||
base = os.getenv("SCHWAB_MCP_BASE_URL", "").rstrip("/")
|
base = os.getenv("SCHWAB_MCP_BASE_URL", _DEFAULT_BASE_URL).rstrip("/")
|
||||||
if base:
|
data.report_url = f"{base}/reports/{ticker.upper()}/pdf"
|
||||||
data.report_url = f"{base}/reports/{ticker.upper()}/pdf"
|
|
||||||
|
|
||||||
return serialize(result)
|
return serialize(result)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user