shutup
This commit is contained in:
parent
7b077423c6
commit
38fcf57424
@ -6,12 +6,10 @@ import socket
|
|||||||
from urllib import parse
|
from urllib import parse
|
||||||
class A(BaseHTTPRequestHandler):
|
class A(BaseHTTPRequestHandler):
|
||||||
def do_POST(self):
|
def do_POST(self):
|
||||||
|
|
||||||
|
|
||||||
dat = self.rfile.read(int(self.headers.get('Content-Length')))
|
dat = self.rfile.read(int(self.headers.get('Content-Length')))
|
||||||
dmr = device_management_pb2.DeviceManagementRequest()
|
dmr = device_management_pb2.DeviceManagementRequest()
|
||||||
dmr.ParseFromString(dat)
|
dmr.ParseFromString(dat)
|
||||||
print(dmr)
|
# print(dmr)
|
||||||
if (dmr.HasField('device_state_retrieval_request')):
|
if (dmr.HasField('device_state_retrieval_request')):
|
||||||
# Expecting a device state response
|
# Expecting a device state response
|
||||||
print("intercepting")
|
print("intercepting")
|
||||||
@ -44,11 +42,12 @@ class A(BaseHTTPRequestHandler):
|
|||||||
self.end_headers()
|
self.end_headers()
|
||||||
dmr = device_management_pb2.DeviceManagementResponse()
|
dmr = device_management_pb2.DeviceManagementResponse()
|
||||||
dmr.ParseFromString(con.content)
|
dmr.ParseFromString(con.content)
|
||||||
print(dmr)
|
# print(dmr)
|
||||||
self.wfile.write(dmr.SerializeToString())
|
self.wfile.write(dmr.SerializeToString())
|
||||||
|
|
||||||
# self.wfile.close()
|
# self.wfile.close()
|
||||||
print("Starting internal server!")
|
|
||||||
|
print("Starting dmbackend!")
|
||||||
hs = HTTPServer(("0.0.0.0", 3040), A,bind_and_activate=False)
|
hs = HTTPServer(("0.0.0.0", 3040), A,bind_and_activate=False)
|
||||||
hs.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, True)
|
hs.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, True)
|
||||||
hs.server_bind()
|
hs.server_bind()
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
echo "$@"
|
SCRIPT_DIR=$(dirname "$0")
|
||||||
SCRIPTDIR=$(readlink -f "$(dirname "$0")")
|
SCRIPT_DIR=${SCRIPT_DIR:-"."}
|
||||||
pushd "${SCRIPTDIR}" || exit
|
|
||||||
if [ ! -e ".venv" ]
|
if [ ! -e ".venv" ]
|
||||||
then
|
then
|
||||||
python3 -m venv .venv
|
python3 -m venv .venv
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
pip3 install -r requirements.txt
|
pip3 install -r requirements.txt &> /dev/null
|
||||||
python3 "$SCRIPTDIR"/server.py
|
python3 "$SCRIPT_DIR"/server.py
|
||||||
popd || exit 0
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user