Marthee commited on
Commit
9d35b62
·
verified ·
1 Parent(s): e3d372c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -40
app.py CHANGED
@@ -91,44 +91,46 @@ def finddata():
91
  keyword = ['115 INTEGRATED MRI ROOM LININGS', '310 ACCURACY']
92
  return pdfLink, keyword
93
 
94
- # @app.route('/apiNBSData', methods=['POST'])
95
- # def NBSData():
96
-
97
-
98
- # try:
99
- # print('In process [Try]')
100
- # data = request.get_json()
101
- # # Extracting values
102
- # pdfLink = data.get('filePath')
103
- # keyword = data.get('NBS_List')
104
-
105
- # # Checking if both values are provided
106
- # if not pdfLink or not keyword:
107
- # return jsonify({"error": "Both 'pdfLink' and 'keyword' must be provided."}), 400
108
-
109
- # keyword = eval(keyword) # Convert the string representation of the list to an actual list
110
-
111
- # # Now you can use the extracted pdfLink and keyword
112
- # print(pdfLink, keyword)
113
- # pdfbytes, pdf_document , df ,tablepdfoutput= findspecsv1.extract_section_under_header(pdfLink, keyword)
114
- # dbxTeam= tsadropboxretrieval.ADR_Access_DropboxTeam('user')
115
-
116
- # # Get metadata using the shared link
117
- # metadata = dbxTeam.sharing_get_shared_link_metadata(pdfLink)
118
- # dbPath='/TSA JOBS/ADR Test/FIND/'
119
- # pdflink= tsadropboxretrieval.uploadanyFile(doc=pdf_document,path=dbPath,pdfname=metadata.name) #doc=doc,pdfname=path,pdfpath=pdfpath+'Measured Plan/
120
- # print('LINKS0',pdflink)
121
-
122
- # dbPath='/TSA JOBS/ADR Test/FIND/'
123
- # tablepdfLink=tsadropboxretrieval.uploadanyFile(doc=tablepdfoutput,path=dbPath,pdfname=metadata.name.rsplit(".pdf", 1)[0] +' Markup Summary'+'.pdf')
124
- # print(f"PDF successfully uploaded to Dropbox at")
125
- # print('LINKS1',tablepdfLink)
126
- # return jsonify(tablepdfoutput)
127
-
128
-
129
- # except Exception as e:
130
- # print(f"Error: {e}")
131
- # return jsonify({"error": str(e)}), 500
132
 
133
- if __name__ == '__main__':
134
- app.run(host='0.0.0.0', port=7860)
 
 
 
 
 
 
91
  keyword = ['115 INTEGRATED MRI ROOM LININGS', '310 ACCURACY']
92
  return pdfLink, keyword
93
 
94
+
95
+ #_________________________________________________________________________________________________________________________
96
+ #_________________________________________________________________________________________________________________________
97
+
98
+ #_________________________________________________________________________________________________________________________
99
+ #_________________________________________________________________________________________________________________________
100
+
101
+ #_________________________________________________________________________________________________________________________
102
+ #_________________________________________________________________________________________________________________________
103
+
104
+ def runn():
105
+ # app.run(host="127.0.0.1")
106
+ from gevent.pywsgi import WSGIServer
107
+ http_server = WSGIServer(("127.0.0.1", 5000), app)
108
+ http_server.serve_forever()
109
+ # serve(app, host="127.0.0.1", port=8080)
110
+
111
+
112
+ def keep_alive():
113
+ t=Thread(target=runn)
114
+ t.start()
115
+
116
+ dtn = datetime.datetime.now(datetime.timezone.utc)
117
+ print(dtn)
118
+ next_start = datetime.datetime(dtn.year, dtn.month, dtn.day, 21, 0, 0).astimezone(datetime.timezone.utc) #us - 2 = utc time (21 utc is 19:00 our time and 9 is 7 our time , it needs to run 9 utc time ____ )
119
+ print(next_start)
120
+ keep_alive()
121
+ while 1:
122
+ dtnNow = datetime.datetime.now(datetime.timezone.utc)
123
+ print(dtnNow)
124
+ if dtnNow >= next_start:
125
+ next_start += datetime.timedelta(hours=12) # 1 day
126
+ print(next_start)
127
+
128
+ time.sleep(1800)
 
 
 
129
 
130
+ # time.sleep(200)
131
+
132
+ if __name__ == "__main__":
133
+ runn()
134
+
135
+ # if __name__ == '__main__':
136
+ # app.run(host='0.0.0.0', port=7860)