commit a3c1de74119c308dc81ec9d98288e3a842fbeeb1 Author: V Date: Sun Jan 26 21:17:16 2025 +0000 Move to PI diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..70ca3b2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +__pycache__ +*.pyc +venv diff --git a/__pycache__/main.cpython-312.pyc b/__pycache__/main.cpython-312.pyc new file mode 100644 index 0000000..b65e344 Binary files /dev/null and b/__pycache__/main.cpython-312.pyc differ diff --git a/main.py b/main.py new file mode 100644 index 0000000..e15d6df --- /dev/null +++ b/main.py @@ -0,0 +1,22 @@ +import re +import json + +from flask import Flask, request +import xmltodict + +app = Flask(__name__) + +@app.route('/') +def hello_world(): + return "Alive!" + +@app.route('/pnp/HELLO') +def pnp_hello(): + return "", 200 + +@app.route('/pnp/WORK-REQUEST', methods=['POST']) +def pnp_work_request(): + src_ip = request.environ.get('HTTP_X_REAL_IP', request.remote_addr) + data = xmltodict.parse(request.data) + print(json.dumps(data, indent=2)) + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/start_app.sh b/start_app.sh new file mode 100755 index 0000000..da5b24e --- /dev/null +++ b/start_app.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +gunicorn -w 4 "main:app" -b 0.0.0.0:80 --reload --access-logfile -