summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--app/energy_service.py15
2 files changed, 16 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 0bc94f9..d181f53 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
__pycache__/
-credentials.py \ No newline at end of file
+credentials.py
+get_response.json \ No newline at end of file
diff --git a/app/energy_service.py b/app/energy_service.py
index 8c43c8a..475939f 100644
--- a/app/energy_service.py
+++ b/app/energy_service.py
@@ -1,10 +1,23 @@
from fastapi import FastAPI
from app.login.login import login
from app.energy_request.energy_request import request
+import os
+import json
app = FastAPI(docs_url=None, redoc_url=None)
+debugFilePath = "./get_response.json"
@app.get('/get')
def get():
+ if (debugFileExists()):
+ print('Debug file present')
+ return getDebugResponse()
sessionKeys = login()
- return request(sessionKeys) \ No newline at end of file
+ return request(sessionKeys)
+
+def getDebugResponse():
+ with open(debugFilePath) as file:
+ return json.load(file)
+
+def debugFileExists():
+ return os.path.isfile(debugFilePath) \ No newline at end of file