fix nasdaq app startup event for newer version of fastapi (#7532)

This commit is contained in:
Danglewood
2026-06-23 00:40:47 -07:00
committed by GitHub
parent d0acbd22f7
commit f04f2fc71f
3 changed files with 17 additions and 16 deletions

View File

@@ -20,6 +20,7 @@ Open the server's URL in your browser for more information on connecting to the
def main():
"""Return a FastAPI app instance."""
# pylint: disable=import-outside-toplevel
from contextlib import asynccontextmanager
from datetime import datetime
from typing import Annotated, Any, Literal
@@ -45,19 +46,9 @@ def main():
reverse=True,
)
app = FastAPI()
async def get_listings() -> DataFrame:
"""Get the Nasdaq listings."""
return listings
Nasdaqlistings = Annotated[
DataFrame,
Depends(get_listings),
]
async def startup_event():
"""Startup event for the FastAPI app."""
@asynccontextmanager
async def lifespan(_: FastAPI):
"""Lifespan event handler for the FastAPI app."""
nonlocal listings
fetcher = NasdaqEquitySearchFetcher()
@@ -71,8 +62,18 @@ def main():
" and not name.str.contains('Warrant')"
" and not name.str.contains('Preferred')"
)
yield
app.add_event_handler("startup", startup_event)
app = FastAPI(lifespan=lifespan)
async def get_listings() -> DataFrame:
"""Get the Nasdaq listings."""
return listings
Nasdaqlistings = Annotated[
DataFrame,
Depends(get_listings),
]
@app.get("/get_symbol_choices", include_in_schema=False)
async def get_symbol_choices(

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "openbb-nasdaq"
version = "1.6.2"
version = "1.6.3"
description = "Nasdaq extension for OpenBB"
authors = ["OpenBB Team <hello@openbb.co>"]
license = "AGPL-3.0-only"