diff --git a/Lesson_6/Task 2/.gitignore b/Lesson_6/Task 2/.gitignore index 1e4c958..85d32e6 100644 --- a/Lesson_6/Task 2/.gitignore +++ b/Lesson_6/Task 2/.gitignore @@ -1 +1,2 @@ +__pycache__ data.db diff --git a/Lesson_6/Task 2/templates/index.html b/Lesson_6/Task 2/templates/index.html index 2546d87..f5f7298 100644 --- a/Lesson_6/Task 2/templates/index.html +++ b/Lesson_6/Task 2/templates/index.html @@ -7,12 +7,18 @@


-
-




+
+
+
+
+
+
+
+
Collected data: diff --git a/Lesson_6/Task 2/webserver.py b/Lesson_6/Task 2/webserver.py index f50c855..b0fce37 100644 --- a/Lesson_6/Task 2/webserver.py +++ b/Lesson_6/Task 2/webserver.py @@ -4,7 +4,7 @@ from databaseWorker import * from flask import Flask, render_template, redirect, request -import platform, psutil, os +import platform, psutil, os, serial.tools.list_ports app = Flask("Computer info") prepareDb("data.db") @@ -21,12 +21,18 @@ def send(): if request.args.get('cpu'): sendData("data.db", "CPU", platform.processor()) - if request.args.get('ram'): - sendData("data.db", "RAM", str(psutil.virtual_memory())) if request.args.get('architecture'): sendData("data.db", "Architecture", str(platform.architecture())) if request.args.get('family'): sendData("data.db", "Family", platform.machine()) + if request.args.get('ram'): + sendData("data.db", "RAM", str(psutil.virtual_memory())) + if request.args.get('os'): + sendData("data.db", "Operating system", os.name) + if request.args.get('disk'): + sendData("data.db", "Disk usage", str(psutil.disk_usage("."))) + if request.args.get('serial'): + sendData("data.db", "Serial ports", str(serial.tools.list_ports.comports())) return redirect('/') app.run(host='0.0.0.0', port=8081)