Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
server/server.py
- Committer:
- Jan Kopa?ski
- Date:
- 2017-01-07
- Revision:
- 16:1569130916f1
- Child:
- 30:27c08888a838
File content as of revision 16:1569130916f1:
from flask import Flask, jsonify
from coapserver import CoAPServer
from databaseconnector import DatabaseConnector
app = Flask(__name__)
host = '46.101.12.31'
coapport = 5683
database = 'kubus.db'
tables = ['pir1', 'pir2', 'distance', 'volume']
connector = DatabaseConnector(database=database, tables=tables)
@app.route("/all")
def all():
d = connector.read()
return jsonify(**d)
if __name__ == '__main__':
coapserver = CoAPServer(host, coapport, tables, connector)
coapserver.daemon = True
coapserver.start()
app.run(host=host)
coapserver.close()