Add simple HanchuESS Helper
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user