-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmpt.py
More file actions
28 lines (23 loc) · 880 Bytes
/
mpt.py
File metadata and controls
28 lines (23 loc) · 880 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from flask import Flask, request
app = Flask(__name__)
current_job_id = None
current_place_id = None
@app.route('/getserver', methods=['GET', 'POST'])
def get_server():
global current_job_id, current_place_id
if request.method == 'POST':
job_id = request.headers.get('JobId')
place_id = request.headers.get('PlaceId')
if job_id and place_id:
current_job_id = job_id
current_place_id = place_id
return "JobId and PlaceId updated", 200
else:
return "Error: Missing JobId or PlaceId", 400
elif request.method == 'GET':
if current_job_id and current_place_id:
return f"JobId: {current_job_id}, PlaceId: {current_place_id}", 200
else:
return "Error: JobId and PlaceId not set", 400
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8080)