Here's my code:
#http://silvo/ESPresso.dll/UpdateDevice?DeviceName=BlueForceTag&DeviceMac=&DeviceSerial=ABBF0002&TxCount=4&Lat=-33.751320&Long=18.533993&BattLevel=4.05&RSSI=-94&hdop=1.20&sats=9&interval=600000
from flask import Flask, request
app = Flask(__name__)
@app.route('/ESPresso.dll/UpdateDevice', methods=['GET'])
def index():
page_response=""
for arg in request.args:
page_response+=str(arg)
return page_response
app.run()
I would like to replace the code in index() to return a text list of all arguments passed in the path with name = value format. e.g. from the example URL at the top:
DeviceName=BlueForceTag
DeviceMac=
DeviceSerial=ABBF0002
etc.
Currently my code returns
DeviceNameDeviceMacDeviceSerialTxCountLatLongBattLevelRSSIhdopsatsinterval
and I can't get hold of the individual "name" / "value" properties of the arg object.
I'm obviously missing something fundamental (probably Python related). Any help appreciated.
{0}={1}'.format(key, value) – Hein du Plessis Sep 21 '20 at 19:20