Modifying functions
This commit is contained in:
parent
ec839d00b7
commit
d8093786a6
1 changed files with 8 additions and 5 deletions
13
myapp.py
13
myapp.py
|
@ -1,12 +1,18 @@
|
|||
import os
|
||||
import sys
|
||||
import flask
|
||||
import evdev
|
||||
import requests
|
||||
import time
|
||||
import threading
|
||||
import urllib.parse
|
||||
|
||||
app = flask.Flask(import_name=__name__)
|
||||
|
||||
try:
|
||||
sys.path.insert(0,'/home/pi/information')
|
||||
except:
|
||||
print("Unable to add 'information' folder into system path")
|
||||
|
||||
lock = threading.Lock()
|
||||
def opener(lck):
|
||||
|
@ -49,11 +55,8 @@ def index():
|
|||
@app.route(rule="/receiving", methods=["POST"])
|
||||
def receiver():
|
||||
data = flask.request.get_data(as_text=True)
|
||||
parts = data.split("&")
|
||||
data_dict = {}
|
||||
for part in parts:
|
||||
parameter_name, parameter_value = part.split("=")
|
||||
data_dict[parameter_name] = parameter_value
|
||||
data_dict = urllib.parse.parse_qs(qs=data)
|
||||
for p in data_dict: data_dict[p]=data_dict[p][0]
|
||||
print(data_dict)
|
||||
response_events = {"events":[]}
|
||||
#---action=incoming---
|
||||
|
|
Loading…
Reference in a new issue