Move to PI

This commit is contained in:
V 2025-01-26 21:17:16 +00:00
commit a3c1de7411
5 changed files with 28 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
__pycache__
*.pyc
venv

Binary file not shown.

22
main.py Normal file
View File

@ -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))

0
requirements.txt Normal file
View File

3
start_app.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
gunicorn -w 4 "main:app" -b 0.0.0.0:80 --reload --access-logfile -