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 os
|
||||||
|
import sys
|
||||||
import flask
|
import flask
|
||||||
import evdev
|
import evdev
|
||||||
import requests
|
import requests
|
||||||
import time
|
import time
|
||||||
import threading
|
import threading
|
||||||
|
import urllib.parse
|
||||||
|
|
||||||
app = flask.Flask(import_name=__name__)
|
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()
|
lock = threading.Lock()
|
||||||
def opener(lck):
|
def opener(lck):
|
||||||
|
@ -49,11 +55,8 @@ def index():
|
||||||
@app.route(rule="/receiving", methods=["POST"])
|
@app.route(rule="/receiving", methods=["POST"])
|
||||||
def receiver():
|
def receiver():
|
||||||
data = flask.request.get_data(as_text=True)
|
data = flask.request.get_data(as_text=True)
|
||||||
parts = data.split("&")
|
data_dict = urllib.parse.parse_qs(qs=data)
|
||||||
data_dict = {}
|
for p in data_dict: data_dict[p]=data_dict[p][0]
|
||||||
for part in parts:
|
|
||||||
parameter_name, parameter_value = part.split("=")
|
|
||||||
data_dict[parameter_name] = parameter_value
|
|
||||||
print(data_dict)
|
print(data_dict)
|
||||||
response_events = {"events":[]}
|
response_events = {"events":[]}
|
||||||
#---action=incoming---
|
#---action=incoming---
|
||||||
|
|
Loading…
Reference in a new issue