윤영준 윤영준 2023-10-30
added gps querying function
@1e6afe116571e9b7eda6a823328414dba8377e44
action.py
--- action.py
+++ action.py
@@ -104,12 +104,10 @@
 class fileUpload(Resource):
     @Action.doc(responses={200: 'Success'})
     @Action.doc(responses={500: 'Register Failed'})
-    def post(self):
+    def get(self):
         if request.method == 'GET':
             db = DB()
-            now = datetime.now()
-            d = now.strftime('%Y-%m-%d %X')
-            value = db.db_display_action(d)
+            value = db.db_display_action()
             return {
                 'report': list(value)
             }, 200
app.py
--- app.py
+++ app.py
@@ -18,5 +18,5 @@
 api.add_namespace(Action, '/action')
 
 if __name__ == "__main__":
-    app.run(debug=False, host='0.0.0.0', port=8080)
+    app.run(debug=True, host='0.0.0.0', port=8080)
     print("Flask Start")
(파일 끝에 줄바꿈 문자 없음)
database/database.py
--- database/database.py
+++ database/database.py
@@ -73,16 +73,13 @@
         ''')
         
         
-    def db_display_action(self,timestamp) :
+    def db_display_action(self) :
         cur = self.conn.cursor() # 커서를 생성한다
-        now=timestamp
-        d_plus=now +timedelta(hours=2)
-        d_plus=str("'"+d_plus.strftime('%Y-%m-%d %X')+"'")
-        d_minus=now -timedelta(hours=2)
-        d_minus=str("'"+d_minus.strftime('%Y-%m-%d %X')+"'")
+        now=datetime.now()
         cur.execute(f'''
-        select * from rds.pothole 
-        where timestamp between {d_minus} and {d_plus};
+        select action_gps_1,action_gps_2 from rds.action ;
         ''')
         result=cur.fetchall()
-        return result
(파일 끝에 줄바꿈 문자 없음)
+        return result
+
+#        where timestamp between {d_minus} and {d_plus}
(파일 끝에 줄바꿈 문자 없음)
Add a comment
List