Question: using this instructions : write a Python program using Flask module and create an API to read each of the parameters values below and display
using this instructions :
write a Python program using Flask module and create an API to read each of the parameters values below and display them through a browser.
FreePhysicalMemory
NumberOfProcesses
TotalVirtualMemorySize
TotalVisibleMemorySize
and store these values in a Python dictionary
complete this code and please check that it works :
if namemain:
cmd 'wmic os get
targets FreePhysicalMemory 'NumberOfProcesses', 'TotalVirtualMemorySize', 'TotalVisibleMemorySize'
systemstat
for target in targets:
newcmd cmd target value
result subprocess.runnewcmd captureoutput True, text True, shell False
lines result.stdout.stripsplit
for line in lines:
if in line:
key, value line.split
value value.strip
systemstattarget value
printsystemstat
the output should look something like this
"FreePhysicalMemory":
"NumberOfProcesses":
"TotalVirtualMemorySize":
"TotalVisibleMemorySize":
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
