-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathqueue_server.py
More file actions
37 lines (27 loc) · 890 Bytes
/
queue_server.py
File metadata and controls
37 lines (27 loc) · 890 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
29
30
31
32
33
34
35
36
#
# simple app to run a server that could handle some info reported by a2p2 while a chara queueserver url is provided
# use pip install flask if not present
#
from flask import Flask, request, jsonify
import socket
import json
from datetime import datetime
from pprint import pprint
app = Flask(__name__)
@app.route('/test', methods=['POST'])
def handleOB():
ob_json = request.get_json()
print("Received OB :")
pprint(ob_json)
# Pick up data from this dictionnary and put it in your system
return 'Received !' # next job is to handle it !
@app.route('/test', methods=['GET'])
def status():
data= {
"service": "OB2 - OBBroker",
"version": 0.1,
"datetime": datetime.now().isoformat(),
"hostname": socket.gethostname(),
}
return jsonify(data), 200
app.run(host="0.0.0.0", port=2468, debug=True)