Add simple HanchuESS Helper

This commit is contained in:
Luke Calladine
2026-01-12 20:27:00 +00:00
parent 6810de2583
commit 5cf970df62
5 changed files with 131 additions and 2 deletions

View File

@@ -6,6 +6,17 @@ app = FastAPI(title="HanchuESS Solar Backend API")
def root():
return {"message": "Welcome to the HanchuESS Solar Backend API!"}
@app.get("/get_access_token", tags=["HanchuESS"])
def get_access_token():
from service.hanchu_service import HanchuESSService
hanchu_service = HanchuESSService()
try:
access_token = hanchu_service.get_access_token()
return {"access_token": access_token}
except Exception as e:
return {"error": str(e)}
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8050)