Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from fastapi import FastAPI, HTTPException
|
| 2 |
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
from pydantic import BaseModel
|
| 4 |
-
import os
|
| 5 |
-
import importlib
|
| 6 |
-
|
| 7 |
-
# ---------- Auto-import all .py files in current folder ----------
|
| 8 |
-
current_dir = os.path.dirname(os.path.abspath(__file__))
|
| 9 |
-
|
| 10 |
-
for file in os.listdir(current_dir):
|
| 11 |
-
if file.endswith(".py") and file not in ["app.py", "__init__.py"]:
|
| 12 |
-
module_name = file[:-3] # remove '.py'
|
| 13 |
-
try:
|
| 14 |
-
globals()[module_name] = importlib.import_module(module_name)
|
| 15 |
-
print(f"Imported module: {module_name}")
|
| 16 |
-
except Exception as e:
|
| 17 |
-
print(f"Failed to import {module_name}: {e}")
|
| 18 |
-
|
| 19 |
|
| 20 |
# ---------- FastAPI app ----------
|
| 21 |
app = FastAPI(title="Stock / Index Backend")
|
|
|
|
| 1 |
+
# Always explicitly import modules used in your endpoint
|
| 2 |
+
import common
|
| 3 |
+
import stock
|
| 4 |
+
import indices_html
|
| 5 |
+
import index_live_html
|
| 6 |
+
import preopen_html
|
| 7 |
+
import eq_html
|
| 8 |
+
import bhavcopy_html
|
| 9 |
+
import nsepython
|
| 10 |
+
import yahooinfo
|
| 11 |
+
import build_nse_fno
|
| 12 |
+
|
| 13 |
from fastapi import FastAPI, HTTPException
|
| 14 |
from fastapi.middleware.cors import CORSMiddleware
|
| 15 |
from pydantic import BaseModel
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
# ---------- FastAPI app ----------
|
| 18 |
app = FastAPI(title="Stock / Index Backend")
|