IoT - Kubus
/
Kubus
JNP3 16/17
Diff: server/databaseconnector.py
- Revision:
- 35:0f01042765d6
- Parent:
- 30:27c08888a838
- Child:
- 36:6686483418a4
diff -r e67581c9b50d -r 0f01042765d6 server/databaseconnector.py --- a/server/databaseconnector.py Tue Jan 17 11:44:16 2017 +0100 +++ b/server/databaseconnector.py Tue Jan 17 11:50:16 2017 +0100 @@ -1,5 +1,6 @@ from sqlite3 import connect, Error from threading import Lock +from datetime import datetime json_template = { 'sensors': [ @@ -43,6 +44,7 @@ if not data: return 'Request message is empty' vals = data.split(self.separator) + vals += [datetime.now()] stmt = ("INSERT INTO %s VALUES (NULL" + (", ?" * len(vals)) + ")") % table self.mutex.acquire() try: